[SOLVED]Javascript exception is thrown when jumping from a dialogue to another

Started by Giacomo, Fri 18/10/2024 13:50:53

Previous topic - Next topic

Giacomo

Thank you, now the arrow buttons are working fine!

I still see the exception in the dialogues series, do you think it is fixable or should I review the script?


In the last case, I need to ask for help again, I'm sorry but I don't know where to turn.
https://ko-fi.com/giacomo97557 To support Falco's adventures

eri0o

Run it here: https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/


paste the error you get in the console under a code tag and inside a spoiler here in the forums. This build should give more complete error log from the console in chrome dev tools - I mean the specific JS messages, they should mention the specific lines in the ags engine code where it's hitting an issue.

Or perhaps if you have an updated build somewhere, and could share it?

Edit: I tried running the old build and using the wheel to get to the error, but the error is somehow in a part of the wasm where it appears it doesn't map to a source file??? (wth, how?)

And also the callstack is showing only things in Emscripten itself... I have never caused something like this, so I have no idea, it would be interesting to get the game source to see in the script what is being called at such point that could cause this. I wonder which ags features the game is using too - things like lipsync and other too classic adventure stuff I basically never used, so I have no idea if it's a bug in one of those old parts of the code somehow... Anyway, it would be nice to get the code to try to comeup with an easier way to reproduce this, since I would like to instrument the code but these make running anything really really slow and doing so much stuff to reproduce is painful.

error.log
Code: plaintext
ags.html:615 Aborted(RuntimeError: unreachable)
printErr @ ags.html:615
abort @ ags.js:439
runAndAbortIfError @ ags.js:12064
maybeStopUnwind @ ags.js:12163
ret.<computed> @ ags.js:12114
doRewind @ ags.js:12212
(anonymous) @ ags.js:12238
callUserCallback @ ags.js:4919
(anonymous) @ ags.js:7257
setTimeout
safeSetTimeout @ ags.js:7255
(anonymous) @ ags.js:11861
handleSleep @ ags.js:12223
_emscripten_sleep @ ags.js:11861
$Emscripten_GLES_SwapWindow @ SDL_emscriptenopengles.c:93
$byn$fpcast-emu$Emscripten_GLES_SwapWindow @ ags.wasm:0x7cb61f
$SDL_GL_SwapWindowWithResult @ SDL_video.c:4205
$SDL_GL_SwapWindow @ SDL_video.c:4210
$AGS::Engine::OGL::OGLGraphicsDriver::Render(int, int, AGS::Common::GraphicFlip) @ ali3dogl.cpp:1181
$byn$fpcast-emu$AGS::Engine::OGL::OGLGraphicsDriver::Render(int, int, AGS::Common::GraphicFlip) @ ags.wasm:0x6f022e
$AGS::Engine::OGL::OGLGraphicsDriver::Render() @ ali3dogl.cpp:965
$byn$fpcast-emu$AGS::Engine::OGL::OGLGraphicsDriver::Render() @ ags.wasm:0x6f014a
$dynCall_vi @ ags.wasm:0x6e3956
ret.<computed> @ ags.js:12110
invoke_vi @ ags.js:13305
$render_to_screen() @ draw.cpp:1198
$render_graphics(AGS::Engine::IDriverDependantBitmap*, int, int) @ draw.cpp:2958
$UpdateGameOnce(bool, AGS::Engine::IDriverDependantBitmap*, int, int) @ game_run.cpp:1027
$GameTick() @ game_run.cpp:1148
$GameLoopUntilState::Run() @ game_run.cpp:184
$byn$fpcast-emu$GameLoopUntilState::Run() @ ags.wasm:0x736b0c
$dynCall_ii @ ags.wasm:0x6e3866
ret.<computed> @ ags.js:12110
invoke_ii @ ags.js:13239
$GameLoopUntilEvent(int, void const*, int, int) @ game_run.cpp:1165
$GameLoopUntilNoOverlay() @ game_run.cpp:1210
$display_main(int, int, int, char const*, TopBarSettings const*, int, int, int, int, int, bool, bool) @ display.cpp:441
$_displayspeech(char const*, int, int, int, int, int) @ character.cpp:2911
$Sc_Character_Say(void*, RuntimeScriptValue const*, int) @ character.cpp:2956
$byn$fpcast-emu$Sc_Character_Say(void*, RuntimeScriptValue const*, int) @ ags.wasm:0x75d775
$ccInstance::Run(int) @ cc_instance.cpp:1363
$ccInstance::CallScriptFunction(AGS::Common::String const&, int, RuntimeScriptValue const*) @ cc_instance.cpp:463
$byn$fpcast-emu$ccInstance::CallScriptFunction(AGS::Common::String const&, int, RuntimeScriptValue const*) @ ags.wasm:0x78bdd5
$dynCall_iiiii @ ags.wasm:0x6e3e04
ret.<computed> @ ags.js:12110
invoke_iiiii @ ags.js:13327
...

eri0o

OK, just switching for software renderer and setting full log and it still crashes

https://gist.github.com/ericoporto/c247bcb751153c43a73cf3fa6990258b

(for anyone reading the log, I think once it crashes the chronological order of the log is reversed...)

Just curious, the character cUomoAppeso is in the room before it becomes the player character? Is there any fun code around the place that it happens? Also does view 26 have something weird vs other views?

Crimson Wizard

@Giacomo , since it crashes at some dialog option, I think you could post at least the code of what happens in that dialog option, to give us any idea of what this crash may be related to.

Also, since it crashes not anytime, but if player selects few other wrong options first, maybe post the code of these options too.
Do you, perhaps, know if there's anything that happens in these wrong options that may affect the script of the correct one?
Or is there anything in these wrong options that may affect the game state? (setting variables, changing object properties, etc)

Crimson Wizard

Ugh! @Giacomo PMed me because he can't post on forums again for some reason. I will ask AGA to maybe look into this.

Here's Giacomo's message he asked me to post here:




@eri0o I'm sorry, I don't undertsand many things because I am no programmer but I'll do my best to let you help me!

cUomoAppeso is already in the room before he becomes the player.

View 26 belongs to the woman in the first scenario, it's for her idle view and for a couple of animations she does once.

Yes, I installed LipSync, I thought it could be used also for tranlsation but I realized don't need it...does anything change if I remove it?

@Crimson Wizard I posted the code of the dialogue options when I made the post, removing only the repetitive script. The dialogue doens't affect anything else in the room.

It's supposed to be a quest where you can't go on until you give the right answer and, to avoid problems due to recursive calls, I chose to force the player to close the dialogue when he miss the answer too many times.

Now the expection is thrown also in the first dialogues series of the game, that the player does once only and where any answer takes to the next dialogue.

I took a video of the first dialogues series, the exception is thrown at 1'14''.
I'm sure I didn't modify anything, but the script that Crimson suggested me and that concerns with the hanging man(cUomoAppeso) dialogues series only.

Download video

Errors log:
Spoiler
Code: ags
Aborted(RuntimeError: unreachable executed) ags_362_cm_744406cd444c:615:96
    printErr https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/:615
    abort https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:439
    runAndAbortIfError https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12029
    maybeStopUnwind https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12128
    x https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12079
    doRewind https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12177
    handleSleep https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12203
    callUserCallback https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:4919
    safeSetTimeout https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:7257
    (Asinc.: setTimeout handler)
    safeSetTimeout https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:7255
    _emscripten_sleep https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:11826
    handleSleep https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12188
    _emscripten_sleep https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:11826
    Emscripten_GLES_SwapWindow https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:5861331
    emu$Emscripten_GLES_SwapWindow https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:7235175
    SDL_GL_SwapWindowWithResult https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:5928835
    ags.wasm.AGS::Engine::OGL::OGLGraphicsDriver::Render(int, int, AGS::Common::GraphicFlip) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:223704
    ags.wasm.byn$fpcast-emu$AGS::Engine::OGL::OGLGraphicsDriver::Render(int, int, AGS::Common::GraphicFlip) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6426698
    ags.wasm.AGS::Engine::OGL::OGLGraphicsDriver::Render() https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:223501
    ags.wasm.byn$fpcast-emu$AGS::Engine::OGL::OGLGraphicsDriver::Render() https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6426478
    dynCall_vi https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6383934
    x https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12075
    invoke_vi https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:13268
    ags.wasm.render_to_screen() https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:1492729
    ags.wasm.render_graphics(AGS::Engine::IDriverDependantBitmap*, int, int) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:1560194
    ags.wasm.UpdateGameOnce(bool, AGS::Engine::IDriverDependantBitmap*, int, int) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:987178
    ags.wasm.GameTick() https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:995053
    ags.wasm.GameLoopUntilState::Run() https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:996930
    ags.wasm.byn$fpcast-emu$GameLoopUntilState::Run() https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6700032
    dynCall_ii https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6383696
    x https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12075
    invoke_ii https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:13202
    ags.wasm.GameLoopUntilEvent(int, void const*, int, int) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:993771
    ags.wasm.display_main(int, int, int, char const*, TopBarSettings const*, int, int, int, int, int, bool, bool) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:1584219
    ags.wasm._displayspeech(char const*, int, int, int, int, int) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:1927743
    ags.wasm.Sc_Character_Say(void*, RuntimeScriptValue const*, int) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:1966472
    ags.wasm.byn$fpcast-emu$Sc_Character_Say(void*, RuntimeScriptValue const*, int) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6838665
    ags.wasm.ccInstance::Run(int) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2617988
    ags.wasm.ccInstance::CallScriptFunction(AGS::Common::String const&, int, RuntimeScriptValue const*) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2596704
    ags.wasm.byn$fpcast-emu$ccInstance::CallScriptFunction(AGS::Common::String const&, int, RuntimeScriptValue const*) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:7014715
    dynCall_iiiii https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6384927
    x https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12075
    invoke_iiiii https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:13290
    ags.wasm.RunScriptFunction(ccInstance*, AGS::Common::String const&, unsigned long, RuntimeScriptValue const*) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2806936
    ags.wasm.byn$fpcast-emu$RunScriptFunction(ccInstance*, AGS::Common::String const&, unsigned long, RuntimeScriptValue const*) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6859176
    dynCall_iiiii https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6384927
    x https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12075
    invoke_iiiii https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:13290
    ags.wasm.run_dialog_script(int, int, int) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2004270
    ags.wasm.run_dialog_option(int, int, int, bool) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2000199
    ags.wasm.do_conversation(int) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2021467
    ags.wasm.byn$fpcast-emu$do_conversation(int) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:7015564
    dynCall_vi https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6383934
    x https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12075
    invoke_vi https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:13268
    ags.wasm.post_script_cleanup() https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2811246
    ags.wasm.byn$fpcast-emu$post_script_cleanup() https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:7014866
    call https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6040621
    x https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12075
    invoke_v https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:13312
    ags.wasm.RunScriptFunction(ccInstance*, AGS::Common::String const&, unsigned long, RuntimeScriptValue const*) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2807532
    ags.wasm.byn$fpcast-emu$RunScriptFunction(ccInstance*, AGS::Common::String const&, unsigned long, RuntimeScriptValue const*) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6859176
    dynCall_iiiii https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6384927
    x https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12075
    invoke_iiiii https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:13290
    ags.wasm.run_dialog_script(int, int, int) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2004270
    ags.wasm.run_dialog_option(int, int, int, bool) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2000199
    ags.wasm.do_conversation(int) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2021467
    ags.wasm.byn$fpcast-emu$do_conversation(int) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:7015564
    dynCall_vi https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6383934
    x https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12075
    invoke_vi https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:13268
    ags.wasm.post_script_cleanup() https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2811246
    ags.wasm.byn$fpcast-emu$post_script_cleanup() https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:7014866
    call https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6040621
    x https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12075
    invoke_v https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:13312
    ags.wasm.RunScriptFunction(ccInstance*, AGS::Common::String const&, unsigned long, RuntimeScriptValue const*) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2807532
    ags.wasm.byn$fpcast-emu$RunScriptFunction(ccInstance*, AGS::Common::String const&, unsigned long, RuntimeScriptValue const*) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6859176
    dynCall_iiiii https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6384927
    x https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12075
    invoke_iiiii https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:13290
    ags.wasm.run_dialog_script(int, int, int) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2004270
    ags.wasm.run_dialog_option(int, int, int, bool) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2000199
    ags.wasm.do_conversation(int) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2021467
    ags.wasm.byn$fpcast-emu$do_conversation(int) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:7015564
    dynCall_vi https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6383934
    x https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12075
    invoke_vi https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:13268
    ags.wasm.post_script_cleanup() https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2811246
    ags.wasm.byn$fpcast-emu$post_script_cleanup() https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:7014866
    call https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6040621
    x https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12075
    invoke_v https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:13312
    ags.wasm.RunScriptFunction(ccInstance*, AGS::Common::String const&, unsigned long, RuntimeScriptValue const*) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2807532
    ags.wasm.byn$fpcast-emu$RunScriptFunction(ccInstance*, AGS::Common::String const&, unsigned long, RuntimeScriptValue const*) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6859176
    dynCall_iiiii https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6384927
    x https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12075
    invoke_iiiii https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:13290
    ags.wasm.run_dialog_script(int, int, int) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2004270
    ags.wasm.run_dialog_option(int, int, int, bool) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2000199
    ags.wasm.do_conversation(int) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2021467
    ags.wasm.byn$fpcast-emu$do_conversation(int) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:7015564
    dynCall_vi https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6383934
    x https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12075
    invoke_vi https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:13268
    ags.wasm.post_script_cleanup() https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2811246
    ags.wasm.byn$fpcast-emu$post_script_cleanup() https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:7014866
    call https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6040621
    x https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12075
    invoke_v https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:13312
    ags.wasm.RunScriptFunction(ccInstance*, AGS::Common::String const&, unsigned long, RuntimeScriptValue const*) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2807532
    ags.wasm.byn$fpcast-emu$RunScriptFunction(ccInstance*, AGS::Common::String const&, unsigned long, RuntimeScriptValue const*) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6859176
    dynCall_iiiii https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6384927
    x https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12075
    invoke_iiiii https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:13290
    ags.wasm.run_dialog_script(int, int, int) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2004270
    ags.wasm.run_dialog_option(int, int, int, bool) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2000199
    ags.wasm.do_conversation(int) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2021467
    ags.wasm.byn$fpcast-emu$do_conversation(int) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:7015564
    dynCall_vi https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6383934
    x https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12075
    invoke_vi https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:13268
    ags.wasm.post_script_cleanup() https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2811246
    ags.wasm.byn$fpcast-emu$post_script_cleanup() https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:7014866
    call https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6040621
    x https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12075
    invoke_v https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:13312
    ags.wasm.RunScriptFunction(ccInstance*, AGS::Common::String const&, unsigned long, RuntimeScriptValue const*) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2807532
    ags.wasm.byn$fpcast-emu$RunScriptFunction(ccInstance*, AGS::Common::String const&, unsigned long, RuntimeScriptValue const*) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6859176
    dynCall_iiiii https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6384927
    x https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12075
    invoke_iiiii https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:13290
    ags.wasm.run_dialog_script(int, int, int) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2004270
    ags.wasm.do_conversation(int) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2021015
    ags.wasm.byn$fpcast-emu$do_conversation(int) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:7015564
    dynCall_vi https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6383934
    x https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12075
    invoke_vi https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:13268
    ags.wasm.post_script_cleanup() https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2811246
    ags.wasm.byn$fpcast-emu$post_script_cleanup() https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:7014866
    call https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6040621
    x https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12075
    invoke_v https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:13312
    ags.wasm.RunScriptFunction(ccInstance*, AGS::Common::String const&, unsigned long, RuntimeScriptValue const*) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2807532
    ags.wasm.RunScriptFunctionAuto(ScriptType, ScriptFunctionRef const&, unsigned long, RuntimeScriptValue const*) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2842881
    ags.wasm.byn$fpcast-emu$RunScriptFunctionAuto(ScriptType, ScriptFunctionRef const&, unsigned long, RuntimeScriptValue const*) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:7015784
    dynCall_viiii https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6384414
    x https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12075
    invoke_viiii https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:13235
    ags.wasm.post_script_cleanup() https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2812179
    ags.wasm.byn$fpcast-emu$post_script_cleanup() https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:7014866
    call https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6040621
    x https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12075
    invoke_v https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:13312
    ags.wasm.RunScriptFunction(ccInstance*, AGS::Common::String const&, unsigned long, RuntimeScriptValue const*) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2807532
    ags.wasm.RunScriptFunctionAuto(ScriptType, ScriptFunctionRef const&, unsigned long, RuntimeScriptValue const*) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2842600
    ags.wasm.byn$fpcast-emu$RunScriptFunctionAuto(ScriptType, ScriptFunctionRef const&, unsigned long, RuntimeScriptValue const*) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:7015784
    dynCall_viiii https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6384414
    x https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12075
    invoke_viiii https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:13235
    ags.wasm.QueueScriptFunction(ScriptType, AGS::Common::String const&, unsigned long, RuntimeScriptValue const*) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:2839892
    ags.wasm.byn$fpcast-emu$QueueScriptFunction(ScriptType, AGS::Common::String const&, unsigned long, RuntimeScriptValue const*) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6763297
    dynCall_viiii https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6384414
    x https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12075
    invoke_viiii https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:13235
    ags.wasm.process_event(AGSEvent const*) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:1994266
    ags.wasm.byn$fpcast-emu$process_event(AGSEvent const*) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6858574
    dynCall_vi https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6383934
    x https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12075
    invoke_vi https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:13268
    ags.wasm.UpdateGameOnce(bool, AGS::Engine::IDriverDependantBitmap*, int, int) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:987780
    ags.wasm.GameTick() https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:995053
    ags.wasm.RunGameUntilAborted() https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:994482
    ags.wasm.byn$fpcast-emu$RunGameUntilAborted() https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6713579
    call https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6040621
    x https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12075
    invoke_v https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:13312
    ags.wasm.initialize_start_and_play_game(int, AGS::Common::String const&) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:1104779
    ags.wasm.byn$fpcast-emu$initialize_start_and_play_game(int, AGS::Common::String const&) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6738663
    dynCall_vii https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6384162
    x https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12075
    invoke_vii https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:13224
    ags.wasm.initialize_engine(std::__2::map<AGS::Common::String, std::__2::map<AGS::Common::String, AGS::Common::String, std::__2::less<AGS::Common::String>, std::__2::allocator<std::__2::pair<AGS::Common::String const, AGS::Common::String>>>, std::__2::less<AGS::Common::String>, std::__2::allocator<std::__2::pair<AGS::Common::String const, std::__2::map<AGS::Common::String, AGS::Common::String, std::__2::less<AGS::Common::String>, std::__2::allocator<std::__2::pair<AGS::Common::String const, AGS::Common::String>>>>>> const&) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:1247582
    ags.wasm.byn$fpcast-emu$initialize_engine(std::__2::map<AGS::Common::String, std::__2::map<AGS::Common::String, AGS::Common::String, std::__2::less<AGS::Common::String>, std::__2::allocator<std::__2::pair<AGS::Common::String const, AGS::Common::String>>>, std::__2::less<AGS::Common::String>, std::__2::allocator<std::__2::pair<AGS::Common::String const, std::__2::map<AGS::Common::String, AGS::Common::String, std::__2::less<AGS::Common::String>, std::__2::allocator<std::__2::pair<AGS::Common::String const, AGS::Common::String>>>>>> const&) https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6945564
    dynCall_ii https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:6383696
    x https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12075
    invoke_ii https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:13202
    main https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:114389
    x https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12075
    doRewind https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12177
    handleSleep https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12203
    callUserCallback https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:4919
    safeSetTimeout https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:7257
    (Asinc.: setTimeout handler)
    safeSetTimeout https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:7255
    _emscripten_sleep https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:11826
    handleSleep https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12188
    _emscripten_sleep https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:11826
    Emscripten_GLES_SwapWindow https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:5861331
    emu$Emscripten_GLES_SwapWindow https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:7235175
    SDL_GL_SwapWindowWithResult https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.wasm:5928835
[close]
Spoiler
Code: ags
Uncaught RuntimeError: Aborted(RuntimeError: unreachable executed). Build with -sASSERTIONS for more info.
    abort https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:459
    runAndAbortIfError https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12029
    maybeStopUnwind https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12128
    x https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12079
    doRewind https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12177
    handleSleep https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:12203
    callUserCallback https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:4919
    safeSetTimeout https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:7257
    setTimeout handler*safeSetTimeout https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:7255
    _emscripten_sleep https://ericoporto.github.io/public_html/ags_362_cm_744406cd444c/ags.js:11826
ags.js:459:11
[close]




EDIT: ah, right, there are these dialog scripts in the first post, I completely forgot about them, sorry.

Giacomo

Ok, I can text again, thank you @Crimson Wizard for posting mt messages!

Let me ask you one more thing: If I run a dialogue and every of its options take me to another unique dialogue, and so on until the last dialogue of the series closes everything, should I put "return" or "stop" at the end of the options of the previous dialogues?

On the dialgues series of the hanging man(cUomoAppeso) I changed every "return" to "stop".

On the first dialogues series of the game every option still has "return", while The last dialogue has "stop" at the end of the startup point and no option.
https://ko-fi.com/giacomo97557 To support Falco's adventures

heltenjon

Quote from: Giacomo on Thu 24/10/2024 12:52:06Let me ask you one more thing: If I run a dialogue and every of its options take me to another unique dialogue, and so on until the last dialogue of the series closes everything, should I put "return" or "stop" at the end of the options of the previous dialogues?

The manual says:
Quote"return" tells AGS to go back and display the choices again to the player. If you use "stop" instead of return, then the conversation is ended. Alternatively, you can use "goto-dialog" or "goto-previous", which abort the current dialog script and transfer control to the new dialog.

Crimson Wizard

@Giacomo Sorry for delay, I finally found time to check this out.

Quote from: Giacomo on Thu 24/10/2024 12:52:06Let me ask you one more thing: If I run a dialogue and every of its options take me to another unique dialogue, and so on until the last dialogue of the series closes everything, should I put "return" or "stop" at the end of the options of the previous dialogues?

So, this question made me look more closely to how do you change the dialogs, and it turned out you were making a mistake.

The problem is not only whether you do "return" or "stop", the main problem is that you were calling Dialog.StartDialog() from within a dialog script. Like this:

Code: ags
  dOminoPapaFinale.Start();
  <...>
return

or this:

Code: ags
  dOminoPapa31.Start(); //open part one of third dialogue
stop


When you call Dialog.Start() from inside another dialog, AGS actually starts a new Dialog "state" before exiting previous one. When you have multiple calls like that done in sequence, there appear multiple "nested" Dialogs running inside each other, like:

   - Dialog1
        -- Dialog2
             -- Dialog3
                   -- Dialog4

Furthermore, if you call one of the previous dialogs again in a same way, the dialog states duplicate! Like:

   - Dialog1
        -- Dialog2
             -- Dialog1
                   -- Dialog2

In theory, this may go forever. But computer does not have infinite nesting power, so at some point it cannot create more of these "dialog states", and crashes. Windows version also crashes eventually, you just need to hit more options to cause this.

This probably may be considered a mistake in AGS design, because it does not handle this correctly, nor reports any warnings about potential issue.

The simplest way to reproduce this bug is to have 2 dialogs that start each other recursively:
Spoiler
Code: ags
//// DIALOG 1
// Dialog script file
@S  // Dialog startup entry point
return
1
narrator: start dialog 2
  dDialog2.Start();
stop
2
narrator: stop here
stop

//// DIALOG 2
// Dialog script file
@S  // Dialog startup entry point
return
1
narrator: start dialog 1
  dDialog1.Start();
stop
2
narrator: stop here
stop

Then run the Dialog1 and keep hitting option 1 at every next step. Eventually, the game will crash.
[close]






So how should this be solved?

First of all DO NOT CALL Dialog.Start function from inside the dialog script!

Instead, use one of the dialog script commands to change between dialogs, as mentioned by @heltenjon above.
I will quote a bigger section of the manual:
https://adventuregamestudio.github.io/ags-manual/DialogScript.html#dialog-commands

Quotegoto-dialog X
Switches the current topic to Topic X, and displays the current list of choices for that topic.
  goto-previous
Returns to the previous topic that this one was called from. If the dialog started on this topic, then the dialog will be stopped.
  return
Stops the script and returns to the list of choices.
  stop
Stops the conversation and returns the player to the game.

So, instead of using dOminoPapa31.Start() you should be doing "goto-dialog dOminoPapa31".
"goto-dialog" also practically works like "stop" for the current dialog, except it opens a new dialog after current one exits.
That should solve your problem.




EDIT:
I suppose that this behavior of Dialog.Start has to be fixed in AGS engine though.
It seems that Dialog.Start is allowed to be called from "dialog_request", that's a callback function that is run when you have a text parser in dialog options.
And apparently it works, although technically still being called from inside the current Dialog state.
So we need to do the same to work even if Dialog.Start was called directly inside dialog script.

Probably this was meant to work back when normal script was not supported inside dialog scripts.
But after normal script was allowed there, commands like Dialog.Start were not adjusted properly.

Giacomo

Thank you @heltenjon and @Crimson Wizard.

Yes, I read that part of the manual, more times ro be honest, because the explanation wasn't very clear to me, for the most the part about the functions goto dialogs, goto previous etc. I did a lot of tests but I couldn't make the script work as I wanted at the end I found that by this way the game didn't crash...so far! Ok, I have a lot of work to do but I'll definitely make it work!

But I will wait before signing the post as solved, just to see if the problem shows up again or not in web version.

The custom dialogues script is something really cool, and I showed how it works to my friends who helped me with the game. Maybe it needs some fixes, yes, but you guys did something great to prevent a lot of scripts in an engine made for graphic adventures, which are full of dialgues!

Thank you again, I am going to work on it!

EDIT: All right, it's working!!! Thank you, thank you, thank you!
I am going to test all the dialogues to be sure and then mark the post as solved.
Sorry, I made you do a lot of work for just a stupid error...Now I learned soemthing very useful:
Inside a dialogue series, use "goto-dialog" at the end of every option, not "stop" nor "return".

A little suggestion: it would ne nice to mark the goto in blue, like stop and return, that would make it easier to understand for stupid newbies like me! Thanks!
https://ko-fi.com/giacomo97557 To support Falco's adventures

eri0o

While warning about the nesting somehow is best, I wonder if, since there should be a way to test that it is inside a dialog, if there would be a way that in such case it could be delayed to happen after. At least I don't feel that the nesting is expected - even though it happens. The issue there is it would trigger a dialog end and start event by doing this way - at least I think?

Crimson Wizard

Quote from: eri0o on Sun 27/10/2024 18:12:21While warning about the nesting somehow is best, I wonder if, since there should be a way to test that it is inside a dialog, if there would be a way that in such case it could be delayed to happen after. At least I don't feel that the nesting is expected - even though it happens. The issue there is it would trigger a dialog end and start event by doing this way - at least I think?

I'm currently working on this in 3.6.2 branch. Not sure if I like to apply this to a 3.6.1 patch... the change I found working is not that big, but it alters the game state flow, and i don't feel 100% confident about it just yet.

It won't trigger the dialog end/start events, it will work more like as if a option script returned with a proper "goto-dialog" command.

When Dialog.Start is called within a script, it's actually scheduled to run after script completes, similar to ChangeRoom, and few other things.
So, this "post-script" execution seems a convenient place to do this.
I found a possible trick: while processing this scheduled command, check if we are inside a dialog, and then not start a new dialog loop, but override the script's return value that is going to be passed back into the current running dialog loop. This return value contains a instruction of what to do (stop dialog, switch to another topic, etc).
In a way, Dialog.Start called within a dialog script will work more like a postponed "goto-dialog".

eri0o

Probably best to have it at 3.6.2 branch where it's still in beta and we can test with a bunch of old games and see if it doesn't happen to break anything, and later it may be just a bugfix that isn't backported - I think if the current behavior was an issue in some old game, something would have cropped up from the ScummVm testers.

Quote from: Crimson Wizard on Sun 27/10/2024 18:32:18When Dialog.Start is called within a script, it's actually scheduled to run after script completes, similar to ChangeRoom, and few other things.
So, this "post-script" execution seems a convenient place to do this.
I found a possible trick: while processing this scheduled command, check if we are inside a dialog, and then not start a new dialog loop, but override the script's return value that is going to be passed back into the current running dialog loop. This return value contains a instruction of what to do (stop dialog, switch to another topic, etc).
In a way, Dialog.Start called within a dialog script will work more like a postponed "goto-dialog".

This sounds like it would work great. I think it would give the expected behavior as an adventure game even though it may not be as consistent when think purely as a programmer (that would expect the nested dialogs).

Crimson Wizard

Quote from: eri0o on Sun 27/10/2024 22:23:03I think it would give the expected behavior as an adventure game even though it may not be as consistent when think purely as a programmer (that would expect the nested dialogs).

To clarify, when I speak of "nested dialog loops", I meant literally - update loops.

Dialog topics themselves can be made nested logically, but run inside a single update loop, using a dialog topic stack. For instance, right now the dialog "executor" saves a history of dialog topics, letting you to return back to the previous ones if necessary ("goto-previous" command).
It may be not fully clear from the syntax's perspective, but it is an available option.

Giacomo

OK, I am definitively having some troubles and they all concern with the "if" statement.

1)I interact with a character, the player walk towards it(with a blocking function), face it, and then the dialogue start.
The convenience of dialogues script is that I can insert command line inside it, but here comes the first trouble.
I put a condition for which, if it's the first time that player talks with this character, I skip some command lines in the entry point and jump to another dialogue, like this:

INTERACT WITH CHARACTER
Spoiler
Code: ags
function cLei_Interact()
{
  if(condition) blablabla
  [...]
  else dLei.Start(); //walk, look at are inside dialogue script, but for the frist time you should jump to another dialogue from the entry point of this
}
[close]

DIALOGUE 1
Spoiler
Code: ags
@S  // Dialog startup entry point
  player.Walk(cLei.x - 26, cLei.y, 1);
  player.FaceDirection(eDirectionDownRight);
  if(!diagLei) dLeiInizio1.Start();
return
[close]

How can I force to jump to another dialogue without having to repeat the commands line to walk and face character?
If not possible, I will simply insert them in the cChar_Interact() function, but I'd have to do this for a lot of characters.

2)In a dialogue the player has to say all the available options before going to the next dialogue, and the options are all set off once they have been clicked on, like this:

DIALOGUE 2
Spoiler
Code: ags
[...]
@2
player:blablabla...
  dThisDialogue.SetOptionState(2, eOptionOffForever);
  if(dThisDialogue.OptionCount == 0) dAnotherDialogue.Start();
return
[...]
[close]

3)Last one concern with a random number that is generated and from that choose which dialogue to jump into.

DIALOGUE 3:
Spoiler
Code: ags
[...]
@6
  _generateNumber();
  if(number == 1) dDialogue1.Start;
  else if(number == 2) dDialogue2.Start();
  else if(number == 3) dDialogue3.Start();
  else if(number == 4) dDialogue4.Start();
[...]
return
[close]

I have a lot of other dialogues with similar problems and I tried to reduce the argument in order to put it simple.

1)In a startup entry point, move to another dialogue if you met a particular condition or go on until the end.
2)In an option of a dialogue, when no more options are available, move to another dialogue, otherwise return to current dialogue.
3)Given a random number, in an option of a dialogue, jump to a dialogue or to another depending from that number value.
https://ko-fi.com/giacomo97557 To support Falco's adventures

Crimson Wizard

Ah, dammit, there are those stupid mistakes in the dialog compiler, where it cannot handle multiple dialog "return" or "goto-dialog" statements in a option even if they are under different "ifs", and also it does not support a variable dialog number in "goto-dialog" apparently.

The solution is explained in this section of the manual:
https://adventuregamestudio.github.io/ags-manual/DialogScript.html#using-regular-scripting-commands-in-dialogs

It is to instead use "real" script "return" command, the one with indentation. It must be followed by either a dialog's number if you want to go to that dialog, or one of the special constants:

Code: ags
  return dSomeDialog.ID;
  return RUN_DIALOG_GOTO_PREVIOUS;
  return RUN_DIALOG_RETURN;
  return RUN_DIALOG_STOP_DIALOG;

So in your case it would be, for example:

Code: ags
@S  // Dialog startup entry point
  player.Walk(cLei.x - 26, cLei.y, 1);
  player.FaceDirection(eDirectionDownRight);
  if(!diagLei) return dLeiInizio1.ID;
return

Giacomo

Thank you @Crimson Wizard . Anyway, this thing of dDialog.ID isn't explained, I guess.

I am going to convert any dDialog.Start() with reurn dDialog.ID and see if it works.
https://ko-fi.com/giacomo97557 To support Falco's adventures

Crimson Wizard

Quote from: Giacomo on Mon 28/10/2024 11:06:29Anyway, this thing of dDialog.ID isn't explained, I guess.

Yes, it's not explained, the manual has a lot of missing things.

Giacomo

Hi, just a little question.

If i do this on dMainDialog:
Spoiler
Code: ags
@S  // Dialog startup entry point

  if(!haveTalkedTo) return dAnotherDialog.ID;
return
[close]

Then, inside dAnotherDialog:
Spoiler
Code: ags
@S  // Dialog startup entry point
  haveTalkedTo = true;
return

@1
  dAnotherDialog.SetOptionState(1, eOptionOffForever); //both lines are present in every option
  if(dAnotherDialog.OptionCount == 0) return dMainDialog.ID;
return
[close]
The control goes back to the player and I can't see dMainDialog again.

But if i do this on dMainDIalog:
Spoiler
Code: ags
@S  // Dialog startup entry point

  if(!haveTalkedTo) dAnotherDialog.Start();
return
[close]

Then inside dAnotherDialog,  keeping the same functions as before, when every option is set off I can go back to dMainDialog. I tested both on windows and web and I see no exception thrown.

So, it seems to be working but I wonder if the two nested dialogues are both closed, once from dAnotherDialogue I go back to dMainDialog and then close the conversation. Do you think it is OK to do so?
https://ko-fi.com/giacomo97557 To support Falco's adventures

Crimson Wizard

Quote from: Giacomo on Wed 30/10/2024 11:19:18Then, inside dAnotherDialog:
Spoiler
Code: ags
@S  // Dialog startup entry point
  haveTalkedTo = true;
return

@1
  dAnotherDialog.SetOptionState(1, eOptionOffForever); //both lines are present in every option
  if(dAnotherDialog.OptionCount == 0) return dMainDialog.ID;
return
[close]
The control goes back to the player and I can't see dMainDialog again.

Your condition here is probably wrong. OptionCount returns the number of total options in a dialog, not number of active options. Since you have 1 (or more?) option in dAnotherDialog, then this condition will always return false.

You need to fix your condition, probably make a custom function that calculates number of active options.

Giacomo

Right, the function is useless and removing it is enough to make it work, as once no option is available, the control returns to the previous dialogue.

Still I wonder if it's ok in this case to use dAnotherDialog.Start().
https://ko-fi.com/giacomo97557 To support Falco's adventures

SMF spam blocked by CleanTalk