2 simple codes (Input names and blinking)

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Post Reply
Message
Author
User avatar
MimirollCookie
Miko-Class Veteran
Posts: 725
Joined: Sat May 23, 2015 5:05 am
Completed: Best Friends (DRAMA), Sweet and Spices (NaNo16)
Projects: Cupid's Wish, Best Friends Deux
Organization: Pastelle Studios
Deviantart: MimirollCookie
Location: A place where rainbows and unicorns collide. ^0^
Contact:

2 simple codes (Input names and blinking)

#1 Post by MimirollCookie » Sat Apr 09, 2016 11:32 am

Howdy y'all!
I'm making a practice project! And I decided to show some simple codes for you guys to use! :D
1. Player-input names
Here's a simple code for the input name. (And an example dialogue.)
First, define the characters!

Code: Select all

define e = Character("[name")
Second, Do this!

Code: Select all

 $ name = renpy.input("What's your name?")
    $ name = name.strip()
    "Hi [name]."
Uguu!~ Just one? Then that's no problem!
First, define the characters!

Code: Select all

define e = Character("[name")
define a = Character("[name2]")

Code: Select all

  $ name = renpy.input("What's your name?")
    $ name = name.strip()
    $ name2 = renpy.input("What's your friend's name?")
    $ name2 = name2.strip()
    "Hi [name] and [name2]."
Want more? Just copy the name2 and make name3 and so on...
2. Blinking expressions!
This is a cool feature for your game!
Do this code. (I used DejiNyucu's Free Rin sprite as an example aaand copied the code from my practice project. :3)
First, you should get a sprite with one open-eyed and the other closed.
Then, copy this code!

Code: Select all

image rin cry blink:
    "sniff.png"
    pause .9
    "sniffclose.png"
    pause .2
    repeat
(Those pause can change too. pause 1 and so on.)
Then, voila!

Code: Select all

show rin cry blink
    with dissolve
    
    e"Umm... Welcome to Rin project 101."
    e"I'm Rin Kagamine, but please call me Rin."
Hope the code will help in simple projects. :D
Last edited by MimirollCookie on Sun Apr 10, 2016 7:11 am, edited 1 time in total.
Image
"If they can do it, you can do it too! make them do it. They can do it, right?" :lol:
Getting a new laptop. Hopefully going back to VN making! (BWAHAHA)

User avatar
Delsin7
Newbie
Posts: 4
Joined: Thu Apr 07, 2016 4:41 pm
Deviantart: delsin07
Contact:

Re: 2 simple codes (Input names and blinking)

#2 Post by Delsin7 » Sat Apr 09, 2016 8:07 pm

Wow, thanks Mimiroll! I just started to use Ren'Py a few days ago and am learning a little bit of python along the way. Simple lines of code are easy enough to understand how and why they work, plus it lets me mess around with a practice vn.

Also your avatar is super adorable. Totes wanna give her a cookie and pat on the head.

User avatar
MimirollCookie
Miko-Class Veteran
Posts: 725
Joined: Sat May 23, 2015 5:05 am
Completed: Best Friends (DRAMA), Sweet and Spices (NaNo16)
Projects: Cupid's Wish, Best Friends Deux
Organization: Pastelle Studios
Deviantart: MimirollCookie
Location: A place where rainbows and unicorns collide. ^0^
Contact:

Re: 2 simple codes (Input names and blinking)

#3 Post by MimirollCookie » Sat Apr 09, 2016 9:15 pm

Delsin7 wrote:Wow, thanks Mimiroll! I just started to use Ren'Py a few days ago and am learning a little bit of python along the way. Simple lines of code are easy enough to understand how and why they work, plus it lets me mess around with a practice vn.

Also your avatar is super adorable. Totes wanna give her a cookie and pat on the head.
I'm glad the codes helped. ^_^
Image
"If they can do it, you can do it too! make them do it. They can do it, right?" :lol:
Getting a new laptop. Hopefully going back to VN making! (BWAHAHA)

User avatar
korova
Veteran
Posts: 217
Joined: Sat Jun 27, 2009 5:15 pm
Completed: Ivy, Chocolate, Time, Clair Obscur
Projects: Writing exercises, The House [Nano18]
Tumblr: korova08
itch: korova
Location: Normandie, France
Contact:

Re: 2 simple codes (Input names and blinking)

#4 Post by korova » Sun Apr 10, 2016 6:51 am

Have you checked indentation ?

Seems off in the code you pasted.

User avatar
MimirollCookie
Miko-Class Veteran
Posts: 725
Joined: Sat May 23, 2015 5:05 am
Completed: Best Friends (DRAMA), Sweet and Spices (NaNo16)
Projects: Cupid's Wish, Best Friends Deux
Organization: Pastelle Studios
Deviantart: MimirollCookie
Location: A place where rainbows and unicorns collide. ^0^
Contact:

Re: 2 simple codes (Input names and blinking)

#5 Post by MimirollCookie » Sun Apr 10, 2016 7:05 am

Ummm.... Yes. Sorry about that. ^_^;
I'll fix it later. :>
Image
"If they can do it, you can do it too! make them do it. They can do it, right?" :lol:
Getting a new laptop. Hopefully going back to VN making! (BWAHAHA)

User avatar
firecat
Miko-Class Veteran
Posts: 540
Joined: Sat Oct 25, 2014 6:20 pm
Completed: The Unknowns Saga series
Projects: The Unknown Saga series
Tumblr: bigattck
Deviantart: bigattck
Skype: bigattck firecat
Soundcloud: bigattck-firecat
Contact:

Re: 2 simple codes (Input names and blinking)

#6 Post by firecat » Tue Apr 12, 2016 4:09 pm

the code is o.k but too many steps compare with the text input that renpy has in the system.

https://www.renpy.org/doc/html/input.html

Code: Select all

define pov = Character("[povname]")

python:
    povname = renpy.input("What is your name?")
    povname = povname.strip()

    if not povname:
         povname = "Pat Smith"

pov "My name is [povname]!"
also has a side note you dont need to name it "povname" that is a tag that the computer finds and connects it. so it can be anything from human1, kid1, player1, etc. this code allows to the developer to code the name without extra unneeded steps and its much more clean way as well.
Image


Image


special thanks to nantoka.main.jp and iichan_lolbot

User avatar
MimirollCookie
Miko-Class Veteran
Posts: 725
Joined: Sat May 23, 2015 5:05 am
Completed: Best Friends (DRAMA), Sweet and Spices (NaNo16)
Projects: Cupid's Wish, Best Friends Deux
Organization: Pastelle Studios
Deviantart: MimirollCookie
Location: A place where rainbows and unicorns collide. ^0^
Contact:

Re: 2 simple codes (Input names and blinking)

#7 Post by MimirollCookie » Wed Apr 13, 2016 4:12 am

firecat wrote:the code is o.k but too many steps compare with the text input that renpy has in the system.

https://www.renpy.org/doc/html/input.html

Code: Select all

define pov = Character("[povname]")

python:
    povname = renpy.input("What is your name?")
    povname = povname.strip()

    if not povname:
         povname = "Pat Smith"

pov "My name is [povname]!"
also has a side note you dont need to name it "povname" that is a tag that the computer finds and connects it. so it can be anything from human1, kid1, player1, etc. this code allows to the developer to code the name without extra unneeded steps and its much more clean way as well.
Thanks firecat. Your code is more detailed. xD
Image
"If they can do it, you can do it too! make them do it. They can do it, right?" :lol:
Getting a new laptop. Hopefully going back to VN making! (BWAHAHA)

Post Reply

Who is online

Users browsing this forum: No registered users