Thanks, while the globals didnt sort it out (on its own without additional work which I wasnt sure how to proceed from) I did look up lists and dictionaries and sure enough the lists work perfectly.
Much better than a string of if/elif statements I had planned for other things (ie days of the week)
Ok spoke to soon:
Code: Select all
idle "/inv/[item[1]].png" clicked Jump("[item[1]]") hovered Show("displayTextScreen", displayText = "[itemtxt[1]]") unhovered Hide("displayTextScreen")
this will find the pic correctly, it will find the itemtxt correctly, but wont jump to the label.
Testing wise Ive done the following:
Bought all the items, saved the game, gone into inventory clicked an item and got an error.
Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/inventory.rpy", line 107, in script
call screen inventory
ScriptError: could not find label '[item[1]]'.
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "C:\Users\Adam\Downloads\renpy-6.99.12.2-sdk\renpy\bootstrap.py", line 295, in bootstrap
renpy.main.main()
File "C:\Users\Adam\Downloads\renpy-6.99.12.2-sdk\renpy\main.py", line 487, in main
run(restart)
File "C:\Users\Adam\Downloads\renpy-6.99.12.2-sdk\renpy\main.py", line 147, in run
renpy.execution.run_context(True)
File "C:\Users\Adam\Downloads\renpy-6.99.12.2-sdk\renpy\execution.py", line 761, in run_context
context.run()
File "game/inventory.rpy", line 107, in script
call screen inventory
File "C:\Users\Adam\Downloads\renpy-6.99.12.2-sdk\renpy\script.py", line 858, in lookup
raise ScriptError("could not find label '%s'." % str(original))
ScriptError: could not find label '[item[1]]'.
Windows-8-6.2.9200
Ren'Py 6.99.12.4.2187
Metastasis 0.1
Load that game and get a "list index out of range" error when trying to look at inventory.
Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/inventory.rpy", line 107, in script
call screen inventory
File "renpy/common/000statements.rpy", line 471, in execute_call_screen
store._return = renpy.call_screen(name, *args, **kwargs)
Exception: In DynamicImage u'/inv/[item[1]].png': IndexError('list index out of range',)
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "game/inventory.rpy", line 107, in script
call screen inventory
File "C:\Users\Adam\Downloads\renpy-6.99.12.2-sdk\renpy\ast.py", line 1706, in execute
self.call("execute")
File "C:\Users\Adam\Downloads\renpy-6.99.12.2-sdk\renpy\ast.py", line 1724, in call
return renpy.statements.call(method, parsed, *args, **kwargs)
File "C:\Users\Adam\Downloads\renpy-6.99.12.2-sdk\renpy\statements.py", line 145, in call
return method(parsed, *args, **kwargs)
File "renpy/common/000statements.rpy", line 471, in execute_call_screen
store._return = renpy.call_screen(name, *args, **kwargs)
File "C:\Users\Adam\Downloads\renpy-6.99.12.2-sdk\renpy\exports.py", line 2526, in call_screen
rv = renpy.ui.interact(mouse="screen", type="screen", roll_forward=roll_forward)
File "C:\Users\Adam\Downloads\renpy-6.99.12.2-sdk\renpy\ui.py", line 285, in interact
rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
File "C:\Users\Adam\Downloads\renpy-6.99.12.2-sdk\renpy\display\core.py", line 2526, in interact
repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, **kwargs)
File "C:\Users\Adam\Downloads\renpy-6.99.12.2-sdk\renpy\display\core.py", line 2793, in interact_core
root_widget.visit_all(lambda i : i.per_interact())
File "C:\Users\Adam\Downloads\renpy-6.99.12.2-sdk\renpy\display\core.py", line 495, in visit_all
d.visit_all(callback)
File "C:\Users\Adam\Downloads\renpy-6.99.12.2-sdk\renpy\display\core.py", line 495, in visit_all
d.visit_all(callback)
File "C:\Users\Adam\Downloads\renpy-6.99.12.2-sdk\renpy\display\core.py", line 495, in visit_all
d.visit_all(callback)
File "C:\Users\Adam\Downloads\renpy-6.99.12.2-sdk\renpy\display\screen.py", line 403, in visit_all
self.child.visit_all(callback)
File "C:\Users\Adam\Downloads\renpy-6.99.12.2-sdk\renpy\display\core.py", line 495, in visit_all
d.visit_all(callback)
File "C:\Users\Adam\Downloads\renpy-6.99.12.2-sdk\renpy\display\core.py", line 495, in visit_all
d.visit_all(callback)
File "C:\Users\Adam\Downloads\renpy-6.99.12.2-sdk\renpy\display\core.py", line 495, in visit_all
d.visit_all(callback)
File "C:\Users\Adam\Downloads\renpy-6.99.12.2-sdk\renpy\display\core.py", line 495, in visit_all
d.visit_all(callback)
File "C:\Users\Adam\Downloads\renpy-6.99.12.2-sdk\renpy\display\core.py", line 492, in visit_all
for d in self.visit():
File "C:\Users\Adam\Downloads\renpy-6.99.12.2-sdk\renpy\display\image.py", line 587, in visit
self.find_target()
File "C:\Users\Adam\Downloads\renpy-6.99.12.2-sdk\renpy\display\image.py", line 499, in find_target
raise Exception("In DynamicImage %r: %r" % (self.name, e))
Exception: In DynamicImage u'/inv/[item[1]].png': IndexError('list index out of range',)
Windows-8-6.2.9200
Ren'Py 6.99.12.4.2187
Metastasis 0.1
What Im not getting is how it works to show the pic and text, then after trying to get it to jump to a label and failing then it wont work at all. I could get that I messed up the syntax or something if it didnt work at all.