Hi,guys:
I want make a random chapter selection function for my game.After my test,random selection and text is ok,but when i add jump function,it fails.
jump function is ok in any other functions,can anybody tell me how to fix this.
screen if_test():
$ randchar = renpy.random.choice([1,2,3])
if (randchar==1) :
text _("result = 1")
jump "add1"
elif (randchar==2) :
text _("result = 2")
jump "add2"
else:
text _("result = 3")
jump "add3"
random chapter selection
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.
- 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: random chapter selection
jump (as a lexer keyword) is only valid in labels
in screens, use
$ renpy.jump( "add1" )
in screens, use
$ renpy.jump( "add1" )
Frameworks & Scriptlets:
- Speech Bubble dialogue system
- Multiple Notify with ATL and history
- (WIP) Radial Masking - needs updating to use Shader
- 7.4 - Smooth Tinting using ATL and matrixcolor
- Several other repositories there too
Re: random chapter selection
still not working,
report:
exception ui.interact called with non -empty widget /layer stacks.
screen if_test():
$ randchar = renpy.random.choice([1,2])
if (randchar==1) :
text _("result = 1")
$ renpy.jump( "add1" )
else:
text _("result ≥ 1")
$ renpy.jump( "add2" )
call screen if_test()
label add1:
e "add1 testing"
label add2:
e "add2 testing"
report:
exception ui.interact called with non -empty widget /layer stacks.
screen if_test():
$ randchar = renpy.random.choice([1,2])
if (randchar==1) :
text _("result = 1")
$ renpy.jump( "add1" )
else:
text _("result ≥ 1")
$ renpy.jump( "add2" )
call screen if_test()
label add1:
e "add1 testing"
label add2:
e "add2 testing"
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3791
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: random chapter selection
Try Jump - with a capital J
Code: Select all
screen if_test():
$ randchar = renpy.random.choice([1,2,3])
if (randchar==1) :
text _("result = 1")
Jump "add1"
elif (randchar==2) :
text _("result = 2")
Jump "add2"
else:
text _("result = 3")
Jump "add3"
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
- IrinaLazareva
- Veteran
- Posts: 399
- Joined: Wed Jun 08, 2016 1:49 pm
- Projects: Legacy
- Organization: SunShI
- Location: St.Petersburg, Russia
- Contact:
Why screen?
Code: Select all
label start:
'Begin'
label chse:
jump expression renpy.random.choice(['ad1', 'ad2', 'ad3'])
label ad1:
"result = 1"
return
label ad2:
"result = 2"
return
label ad3:
"result = 3"
return
https://www.renpy.org/doc/html/other.html#renpy-random
Who is online
Users browsing this forum: Google [Bot]