if selected else

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
johannes89
Newbie
Posts: 7
Joined: Sun Oct 07, 2018 9:34 am
Contact:

if selected else

#1 Post by johannes89 »

Hey guys i want some help please im having difficulty with my code not sure how to get it rectified

i want to make point system so if you do something you get a point so with that im using

Code: Select all

$ Elly_points = 0
then i wan to do future where if you got the points you can go to do the thing you wanted to do if you dont have points you cant do it

Code: Select all

label choice3:
    if Elly_points <= 0:
        "you do not have enought point to pick her up"
        pause
        jump outside2
    # always add this for both choices after the menu, this hides the previous message that we left visible during the menu
        call phone_after_menu
    if Elly_points == 1:    
        # whenever you put the sender name to be "me" it is the player characters own message!
        call message_start("me", "Yes ofcourse sweetheart, see you in a minute")
then after you choose to pick her up and you do have points it will take her to the office if he dont have points it must say you dont have enough points like it does but then you still must have the future to go to the office but here is where my problem is if i dont have points and want to go and pick her up its suppose to say you dont have points and then take you to the outside after the choice

i then have another option where if you have picked her up you can go to work if not you must go back to pick her up but if you dont have points that event must be skipped but it does not it just say pickup is not defined

here are the code for the office and pickup

Code: Select all

label choice3:
    if Elly_points <= 0:
        "you do not have enought point to pick her up"
        pause
        jump outside2
    # always add this for both choices after the menu, this hides the previous message that we left visible during the menu
        call phone_after_menu
    if Elly_points == 1:    
        # whenever you put the sender name to be "me" it is the player characters own message!
        call message_start("me", "Yes ofcourse sweetheart, see you in a minute")
        call message("Receptionest", "Thank you so much :)")
pause
$ Elly_pickup = True

jump outside2

label choice4:
    
        call phone_after_menu
        call message_start("me", "Not today")
        call message("Receptionest", "ok thank you will make another plan.")
pause
$ Elly_pickup = False

pause
jump outside2


    # this one puts away the phone!
call phone_end

label outside2:   
        call screen mapscreen
        pause

label receptionest:
    if Elly_pickup == True:
        (player_name)"hey lets go to work "
        show screen office
        pause
        jump work

label work:
    if Elly_pickup == False:
        show screen office
        "Heading out to the office to get to the office in time."
        
        pause
what must i change at the label work: if she was not picked up that you can still proceed to go to work

User avatar
Per K Grok
Miko-Class Veteran
Posts: 882
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: if selected else

#2 Post by Per K Grok »

johannes89 wrote: Sat Oct 20, 2018 7:07 am ---
i then have another option where if you have picked her up you can go to work if not you must go back to pick her up but if you dont have points that event must be skipped but it does not it just say pickup is not defined

---
With this code the player will jump to office if Elly is picked up and also if the player have too few points to pick her up, and else the player will jump back to the pickup label. (I made the labels names up)

Code: Select all

if Elly_pickup==True:
    jump office
elif Elly_pickup==False:
    if Elly_points<= 0:
        jump office
    else:
        jump pickup

also, when you do this

Code: Select all

jump outside2
call phone_after_menu
the 'call phone_after_menu' will not be played. You have to put that before the jump command.

johannes89
Newbie
Posts: 7
Joined: Sun Oct 07, 2018 9:34 am
Contact:

Re: if selected else

#3 Post by johannes89 »

it say Elly_pickup not defined but elly pickup is just a function must i define it with a label? sorry for the stupid questions im trying to learn this coding

User avatar
Per K Grok
Miko-Class Veteran
Posts: 882
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: if selected else

#4 Post by Per K Grok »

johannes89 wrote: Mon Oct 22, 2018 2:54 pm it say Elly_pickup not defined but elly pickup is just a function must i define it with a label? sorry for the stupid questions im trying to learn this coding
Elly_pickup is a variable with a value of True or False.

You can define it before the Start label

define Elly_pickup= False

It is good practice to do that.

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: if selected else

#5 Post by trooper6 »

You should use default to define elly_pickup, not define.

default is for variables that can change over the course of the game.
define is for things that will never change
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

Post Reply

Who is online

Users browsing this forum: Ocelot