Image Map and variable update

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
Starvy_Jedi
Newbie
Posts: 16
Joined: Mon Jun 03, 2019 1:33 pm
Contact:

Image Map and variable update

#1 Post by Starvy_Jedi » Thu Jun 13, 2019 4:55 pm

Hi guys! This forum is amazing! :) And I'm learning a lot.

Just a stupid noob question.

I'm using the "Simple script for a day_night cycle, or rather a morning, noon, evening & night cycle" from the cookbook.
It works like a charme.
Now, in my game, I'm using a button (an hotspot in an image map) to manually skip day times...
I'm doing this calling a label.

Code: Select all

imagemap:
     ground "buttons/ui_ground.png"
     idle "buttons/ui_idle.png"
     hover "buttons/ui_hover.png"
     hotspot (1006, 15, 123, 114) action Call ("timeflow1") #skip daytime
        
label timeflow1:
    $ clock.advance() # advances time by one slot
    "You spent some time fooling around..."
    return
So the question is: can I set that $ clock.advance() directly inside the hotspot action?

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Image Map and variable update

#2 Post by Remix » Thu Jun 13, 2019 7:17 pm

Code: Select all

action Function( clock.advance )
If that doesn't update things as you want, perhaps add a restart interaction...

Code: Select all

action [ Function( clock.advance ), Function( renpy.restart_interaction ) ]
Frameworks & Scriptlets:

User avatar
Starvy_Jedi
Newbie
Posts: 16
Joined: Mon Jun 03, 2019 1:33 pm
Contact:

Re: Image Map and variable update

#3 Post by Starvy_Jedi » Fri Jun 14, 2019 3:26 am

Thank u very much Remix!
:D
The first one works perfectly!

The second one is very interesting!
I'm sure I will need the restart_interaction soon or later... I take note!


Remix wrote:
Thu Jun 13, 2019 7:17 pm

Code: Select all

action Function( clock.advance )
If that doesn't update things as you want, perhaps add a restart interaction...

Code: Select all

action [ Function( clock.advance ), Function( renpy.restart_interaction ) ]

Post Reply

Who is online

Users browsing this forum: Google [Bot]