[SOLVED]variables getting changed when they should not be

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
User avatar
Scribbles
Miko-Class Veteran
Posts: 636
Joined: Wed Sep 21, 2016 4:15 pm
Completed: Pinewood Island, As We Know It
Projects: In Blood
Organization: Jaime Scribbles Games
Deviantart: breakfastdoodles
itch: scribbles
Location: Ohio
Contact:

[SOLVED]variables getting changed when they should not be

#1 Post by Scribbles »

SOLVED- I had dumb code plugged in elsewhere for no reason

In my game's time manager a player is given the choice of 3 locations for free time, when they make 1 of 3 choices the variable decide is changed to either library, gym, or lounge.

THEN the free time count is adjusted so that the events of each place are somewhat linear.

Basically if they go to the library 5 times, it should call library event 6 the next time it's chosen.

But if Gym is chosen it should call gym event 1. but its not doing that. It's calling gym event 6 ????

I can't figure out why it's doing that. This section of code is the only time the count variables are changed and I can't figure out why it isn't working ??? help????

side note: if the days are 2, 4, 6, or 7 a whole different set up happens and that works fine.

Code: Select all

    call screen choice_map
    with dissolve

    if decide == "library":
        scene bg library
        with fade
        if day == 1 or day == 3 or day == 5:
            $ li_cnt += 1
            $ fte_cnt = li_cnt

    if decide == "gym":
        scene bg gym
        with fade
        if day == 1 or day == 3 or day == 5:
            $ ge_cnt += 1
            $ fte_cnt = ge_cnt

    if decide == "lounge":
        scene bg lounge
        with fade
        if not lonVisited:
            call lonIntro from _call_lonIntro
            $ lonVisited = True
            return
        else:
            if day == 1 or day == 3 or day == 5:
                $ be_cnt += 1
                $ fte_cnt = be_cnt


    if day == 1 or day == 3 or day == 5:
        if fte_cnt <= freetime_max:
            call expression str(decide) + "_fixed_event_" + str(fte_cnt) from _call_expression_17
        else:
            call expression str(decide) + "_event_done" from _call_expression_19
    else:
        call expression str(decide) + "_generic_event" from _call_expression_18
        
Last edited by Scribbles on Wed Dec 12, 2018 8:13 pm, edited 1 time in total.
Image - Image -Image

DannX
Regular
Posts: 99
Joined: Mon Mar 12, 2018 11:15 am
Contact:

Re: variables getting changed when they should not be

#2 Post by DannX »

I can't seem to find any problem in the code you've posted here, at least testing it in a brand new project with some quickly-typed labels to test out. My only guess is that fte_cnt is not being set properly somewhere, as it is the variable that you use to determine wich event to call. If you want I can post my test code, though it is a bit large.

User avatar
Scribbles
Miko-Class Veteran
Posts: 636
Joined: Wed Sep 21, 2016 4:15 pm
Completed: Pinewood Island, As We Know It
Projects: In Blood
Organization: Jaime Scribbles Games
Deviantart: breakfastdoodles
itch: scribbles
Location: Ohio
Contact:

Re: variables getting changed when they should not be

#3 Post by Scribbles »

I went through and found some random code that set all the counters to 13 for some reason???? not sure why I wrote that or left it in > < Only found it by slowly testing!
Image - Image -Image

Post Reply

Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot]