Forcing a label call in screen
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.
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.
Forcing a label call in screen
Hi guys! I'm trying to force people to go back to the room when the time passes 23:00.
What I've been doing so far is to have an imagebutton covering the entire screen at that time, but it's incredibly buggy.
I've tried adding $renpy.jump('tooLate'), $renpy.call('tooLate'), but none of it is working.
Of course, a simple jump (label) would not work, as it's a screen.
Is there a handy way of forcing a label jump at a certain position inside a screen? I'm using my quick menu screen to do it.
What I've been doing so far is to have an imagebutton covering the entire screen at that time, but it's incredibly buggy.
I've tried adding $renpy.jump('tooLate'), $renpy.call('tooLate'), but none of it is working.
Of course, a simple jump (label) would not work, as it's a screen.
Is there a handy way of forcing a label jump at a certain position inside a screen? I'm using my quick menu screen to do it.
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3794
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: Forcing a label call in screen
I think (without seeing how you are doing what you are doing) you may want to use a timer.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Twitter
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
- trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
- Contact:
Re: Forcing a label call in screen
What sort of clock are you using to keep time? How are you adding time to the clock?
Depending on the answers to those questions, you may not need some giant screen at all, by the way.
Depending on the answers to those questions, you may not need some giant screen at all, by the way.
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
*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
Re: Forcing a label call in screen
It's a simple variable that I'm using. I increment the "tod" variable when I do certain things as the character
- trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
- Contact:
Re: Forcing a label call in screen
That is pretty easily done with a callback function. I have to go to work and won’t be back home until late tonight, but when I get home I’ll put up some code for you. Quick question, when you get the time out do you want to jump to the label (you aren’t coming back), or call the label (you return after the scene)?
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
*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
Re: Forcing a label call in screen
I want it to stay there, the label is small, and jumps to the room.
is the label I want to jump to.
Code: Select all
label tooLate:
$loc = "room"
c "{i}It's getting late. I should get back to my room{/i}"
jump room
Re: Forcing a label call in screen
As trooper6 said what you are looking for can be achieved through callback. Put this code somewhere at the start of your script or wherever.trooper6 wrote: ↑Mon Mar 26, 2018 8:23 am That is pretty easily done with a callback function. I have to go to work and won’t be back home until late tonight, but when I get home I’ll put up some code for you. Quick question, when you get the time out do you want to jump to the label (you aren’t coming back), or call the label (you return after the scene)?
Code: Select all
default tod = 0 #seconds
init python:
time_check = False
def late_call:
if time_check and tod >= 82800 # roughly translates to 23 hours:
time_check = False
renpy.jump('Toolate')
config.python_callbacks.append(late_call)
label start:
# Day start
time_check = True
# things player does as time increments
#sample : player eats dinner
$ tod += 82800
label tooLate: # Should auto jump to this when the tod reaches 23 hours
$loc = "room"
c "{i}It's getting late. I should get back to my room{/i}"
jump room
Code: Select all
default tod = 0 #hours
init python:
time_check = False
def late_callback:
if time_check and tod >= 23 # in hours:
time_check = False
renpy.jump('Toolate')
config.python_callbacks.append(late_call)
Re: Forcing a label call in screen
I can show how the clock works, it's extremely simple, basically just a variable that gets incremented on certain events. It's only whole hour increments.
On every load of scene this is called
timeLoc is simply a function to place someone at the correct spot (a ton of if statements)
timeAndDay is this
I have a feeling that this isn't a very smart way of making the encounters and time work, but for now it works, at least.
It seems as though the deciding factor, so to speak, is the line
"config.python_callbacks.append(late_call)"
Which I believe would fix this?
Code: Select all
"Relax":
"You relax in the common area for an hour."
$tod += 1
jump hall2
Code: Select all
screen quick_menu():
zorder 100
$timeLoc()
$timeandDay()
$whichDay()
timeAndDay is this
Code: Select all
def timeandDay():
global tod, day, dayNr
if tod == 24:
tod = 0
reset()
day+=1
dayNr+=1
if day > 6:
day = 0
return
Code: Select all
def whichDay():
global week, today, day
today = week[day]
return
It seems as though the deciding factor, so to speak, is the line
"config.python_callbacks.append(late_call)"
Which I believe would fix this?
Re: Forcing a label call in screen
Yeah more or less what's important is that your functions work There are some timebased scripts in the cookbook likewise the daily planner or dse I believe also has the same mechanic and maybe someone here could help better optimize your code. As for callback the config.python_callbacks.append(late_call) is the line in order to add events or callback functions so that renpy could recognize your callback. Assuming I haven't screwed up anywhere in my code then the hour based callback should work for you. Just don't forget to set the time_check before start of the day else it would return an error. If you have any problems just msg up.
Who is online
Users browsing this forum: Google [Bot], voluorem