Eternal loop of doom with the image map [SOLVED]

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
Destiny
Veteran
Posts: 468
Joined: Thu Jun 14, 2012 2:00 pm
Projects: Cards of Destiny, Sky Eye
Location: Germany
Contact:

Eternal loop of doom with the image map [SOLVED]

#1 Post by Destiny »

My game has six image maps where the MC can decide, which bachelor to visit.
So obviously, I want the game to later differ, if the character had been already visited or not.
But for a weird reason, the game always jumps back to the first scene (as if the place had never been visited).

Well, everytime a place is visited, I activate a statement

Code: Select all

label park_1:
    $ park_1_done
    scene bg park
    #insert conversation here
I also made sure that the game does not circle from the events part by making a statement for each imagemap and then doing this

Code: Select all

label a1:
    if "imagemap_1":
        jump schule_2
    elif "imagemap_2":
        jump schule_3
    elif "imagemap_3":
        jump schule_4
    elif "imagemap_4":
        jump schule_5
    elif "imagemap_5":
        jump schule_6
    elif "imagemap_6":
        jump schule_7
The game does react appropietly in this part, it jumps to the school label BEHIND the last imagemap, I tested that out seperately.
(I had tried out to turn the order the other way which somehow always ended with the game jumping to the very end, even though $ imagemap_6 was definitly not set on True anywhere ô__ô)

Whenever the place had been visited, the best friend will ask where the MC went, the MC will name the correct place, they talk about it, game goes on until the next imagemap.
AND THEN the game doesn't call the NEXT scene of the chosen place, if I decide to visit a place twice.
For example, the first visit to the park will have the MC meet a cat. The second time, he will look for the cat and feed it. But the game does always call the first visit.

The code for choosing the spots would be

Code: Select all

q "Hm, what to do... \nMary should be in the park with Andy..."
$ imagemap_1 = True

$ result = renpy.imagemap("Backgrounds/schule.png", "Backgrounds/hover.png", [
                           (41, 41, 227, 140, "park_e"),
                           (346, 39, 531, 136, "untere_etage_e"),
                          ])

if result == "park_a":
    call park_a
elif result == "untere_etage_a":
    call untere_etage_a
        
label park_a:
    if park_1_done:
        stop music
        jump park_2
    else:
        stop music
        jump park_1
label untere_etage_a:
    if untere_etage_1_done:
        stop music
        jump untere_etage_2
    else:
        jump untere_etage_1
It doesn't work, it just always jumps to event_1
I have also tried it with

Code: Select all

label sporthalle_a:
    if sporthalle_1_done:
        stop music
        jump sporthalle_2
    if not sporthalle_1_done:
        stop music
        jump sporthalle_1
, doesn't work either.

I am kind of at a loss about how to stop that circling. I can't exactly figure out what I am doing wrong.
All statements are set to False in the init, so it can't be that some of them are active without reason.
Or maybe I am just doing it more complicated then I should again?
Or I use old code which results in a circle? (but then again, I ran through pretty much every text on http://www.renpy.org/wiki/ that had a "if" in it and tried out most of them...)
Last edited by Destiny on Sat Mar 22, 2014 10:01 am, edited 1 time in total.
Image
Cards of Destiny (WIP) / Sky Eye (WIP)

Asceai
Eileen-Class Veteran
Posts: 1258
Joined: Fri Sep 21, 2007 7:13 am
Projects: a battle engine
Contact:

Re: Eternal loop of doom with the image map

#2 Post by Asceai »

I didn't read the whole post because I was too bothered by

Code: Select all

    if "imagemap_1":
        jump schule_2
Er, what is this supposed to do, exactly?

Because I can see what it will do- "imagemap_1" will evaluate to True so it will always 'jump schule_2'.

If you want to check the value of imagemap_1, you need to do this:

Code: Select all

if imagemap_1:
You actually have to set all your imagemap_# variables to False somewhere else first, though, otherwise you will get errors for undeclared variables.

User avatar
Destiny
Veteran
Posts: 468
Joined: Thu Jun 14, 2012 2:00 pm
Projects: Cards of Destiny, Sky Eye
Location: Germany
Contact:

Re: Eternal loop of doom with the image map

#3 Post by Destiny »

If you had read the post, you would have seent that I made all of them as false in the init.
Here is the code, JUST in case.

Code: Select all

init:
    $ sporthalle_1_done = False
    $ sporthalle_2_done = False
    $ sporthalle_3_done = False
    $ sporthalle_4_done = False
    $ sporthalle_5_done = False
    $ sporthalle_6_done = False
    $ untere_etage_1_done = False
    $ untere_etage_2_done = False
    $ untere_etage_3_done = False
    $ untere_etage_4_done = False
    $ untere_etage_5_done = False
    $ untere_etage_6_done = False
    $ derek_1_done = False
    $ derek_2_done = False
    $ derek_3_done = False
    $ derek_4_done = False
    $ derek_5_done = False
    $ derek_6_done = False
    $ obere_etage_1_done = False
    $ obere_etage_2_done = False
    $ obere_etage_3_done = False
    $ obere_etage_4_done = False
    $ obere_etage_5_done = False
    $ obere_etage_6_done = False
    $ dach_1_done = False
    $ dach_2_done = False
    $ dach_3_done = False
    $ dach_4_done = False
    $ dach_5_done = False
    $ dach_6_done = False
    $ park_1_done = False
    $ park_2_done = False
    $ park_3_done = False
    $ park_4_done = False
    $ park_5_done = False
    $ park_6_done = False
    $ schwimmbad_1_done = False
    $ schwimmbad_2_done = False
    $ schwimmbad_3_done = False
    $ schwimmbad_4_done = False
    $ schwimmbad_5_done = False
    $ schwimmbad_6_done = False
    $ schule_4_done = False
    $ schule_5_done = False
    $ schule_6_done = False
    $ imagemap_1 = False
    $ imagemap_2 = False
    $ imagemap_3 = False
    $ imagemap_4 = False
    $ imagemap_5 = False
    $ imagemap_6 = False
Also, like I also said in the first post:
Changing the order of the statements does nothing.

Code: Select all

    if imagemap_6:
        jump schule_7
    elif imagemap_5:
        jump schule_6
    elif imagemap_4:
        jump schule_5
    elif imagemap_3:
        jump schule_4
    elif imagemap_2:
        jump schule_3
    elif imagemap_1:
        jump schule_2
results in the same loop.

I also tried out

Code: Select all

$ imagemap_1 = False
$ imagemap_2 = True

$ result = renpy.imagemap("Backgrounds/schule.png", "Backgrounds/hover.png", [
                           (41, 41, 227, 140, "park_e"),
                           (346, 39, 531, 136, "untere_etage_e"),
                          ])
#and so on
in case, the codes collide somewhat.

I took away the ", didn't do anything either.
Image
Cards of Destiny (WIP) / Sky Eye (WIP)

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Eternal loop of doom with the image map

#4 Post by Alex »

Try

Code: Select all

label park_1:
    $ park_1_done = True

User avatar
Destiny
Veteran
Posts: 468
Joined: Thu Jun 14, 2012 2:00 pm
Projects: Cards of Destiny, Sky Eye
Location: Germany
Contact:

Re: Eternal loop of doom with the image map

#5 Post by Destiny »

Thanks Alex
That (in combination with putting the previous event to False) seems to have done the trick.
Its still looping every now and then, but I guess, that just means I have overseen code at one point or the other.
I look through everything properly, should it still loop despite me not finding any obvious problem, then I probably be back here in no time anyway :'D

EDIT:
Yep, had forgotten a " at two points which made the game loop again.
It is solved so far, so yaaaaaay :D
Image
Cards of Destiny (WIP) / Sky Eye (WIP)

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], bonnie_641, Google [Bot]