So, I need to so another screen (with argument) from another screen.
First I have two objects like this:
Then I have these two screens:
I want the enemy_scr to show when I press the "Search for enemy" button from the dungeon_scr, but all I got is this error:
When I try to show the screen by typing show screen in the console it works fine, but not when using the button. Is there anyway to make this works other than make the button jump to another label then call the screen there instead?
First I have two objects like this:
Code:
test_dungeon_1st_floor = Dungeon(
name = "Test Dungeon 1st Floor",
bg = "test_dungeon_bg.webp",
progress = 0,
mob_spawn = [slime]
)
slime = Enemy(
name = "Slime",
hp = 30,
max_hp = 30,
lvl = 1,
atk = 5,
defense = 1,
spd = 1
)
Code:
screen dungeon_scr(dungeon, next_floor=False):
zorder 0
add dungeon.bg
frame:
xalign 0.1
yalign 0.1
vbox:
spacing 10
text dungeon.name
bar:
value dungeon.progress
range 100
textbutton "Search around" action SetField(dungeon, "progress", dungeon.progress + 10)
textbutton "Search for enemy" action Show("enemy_scr", dungeon.mob_spawn) <------- The problem is here
textbutton "Next floor" action [SetField(dungeon, "progress", 0), Jump(next_floor)] sensitive dungeon.progress > 99 and next_floor != False
screen enemy_scr(mob):
zorder 1
python:
while len(enemy_list) < 10:
enemy_to_add = renpy.random.choice(mob)
enemy_list.append(enemy_to_add)
frame:
vbox:
spacing 10
for enemy in enemy_list:
text enemy.name
Code:
```
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/declaration.rpy", line 104, in script
call screen dungeon_scr(test_dungeon_1st_floor, "Test_Dungeon_2nd_Floor")
File "renpy/common/000statements.rpy", line 609, in execute_call_screen
store._return = renpy.call_screen(name, *args, **kwargs)
TypeError: 'RevertableList' object is not callable
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "game/declaration.rpy", line 104, in script
call screen dungeon_scr(test_dungeon_1st_floor, "Test_Dungeon_2nd_Floor")
File "D:\Renpy 8\renpy\ast.py", line 2232, in execute
self.call("execute")
File "D:\Renpy 8\renpy\ast.py", line 2220, in call
return renpy.statements.call(method, parsed, *args, **kwargs)
File "D:\Renpy 8\renpy\statements.py", line 281, in call
return method(parsed, *args, **kwargs)
File "renpy/common/000statements.rpy", line 609, in execute_call_screen
store._return = renpy.call_screen(name, *args, **kwargs)
File "D:\Renpy 8\renpy\exports.py", line 3181, in call_screen
rv = renpy.ui.interact(mouse="screen", type="screen", roll_forward=roll_forward)
File "D:\Renpy 8\renpy\ui.py", line 299, in interact
rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
File "D:\Renpy 8\renpy\display\core.py", line 3377, in interact
repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, pause=pause, pause_start=pause_start, pause_modal=pause_modal, **kwargs) # type: ignore
File "D:\Renpy 8\renpy\display\core.py", line 3752, in interact_core
trans = self.ongoing_transition[None](
TypeError: 'RevertableList' object is not callable
Windows-10-10.0.19044 AMD64
Ren'Py 8.0.3.22090809
Dungeon and Combat 1.0
Sat Jan 21 05:33:57 2023
```