Bug Report for CJ/Proskrito with SCUMM GUI's

Started by juncmodule, Thu 23/10/2003 00:47:54

Previous topic - Next topic

juncmodule

I recieved the following error when trying to use the "walk to" mode in the template without any alterations.

(ACI version 2.57.642)

Error: run_text_script1: error -1 (Runtime error: wrong number of parameters to exported function 'unhandled_event') running function 'unhandled_event'

Same thing happened with FOA template.

The errors do not occur with 2.56d.

I'm assuming this may not be an error, it appears as if a new parameter was added for the unhandled_event function in the newest version. Either way, I figured one of you should know about this.

later,
-junc

Proskrito

#1
The thing is that i changed the unhandled event function, so it has no parameters.
You could try to replace:
function unhandled_event()
with:
function unhandled_event(int fhgsh, int sjhgfs), so the number of parameters is right, but they do nothing. (a bit crappy aswer but ...  :-\ )

EDIT: Oh, then, it that would work, you should call every unhandled event with 2 parameters, which is not very good...

I dont know why in previous versions this didnt happen, and now it does.

Let see if chris tell us something...

2nd EDIT: I think i might have found a workaround:
you could do what i told you about putting two unuseful (¿?)  parameters, then, in order to not have to write the 2 parameters in the interactions, you could make a function named Unhandled, that would look like:
Code: ags
function Unhandled(){
unhandled_event(0,0);
}

and put it under the unhandled_event one, and also put it in the script header, replacing unhandled_event().
then in the interactions, you would write:
Code: ags
function inventory1_a() {
  // script for inventory1: Other click on inventory item
if (UsedMode("open")) Display("opening");  
else Unhandled();
}

it works for me.

i believe chris could have a better answer, but just in case...

Pumaman

unhandled_event is a function defined by AGS, which is called by AGS when an interaction is not handled.

AGS calls it with two parameters, as documented in the help file.

Therefore, you must define it with those two parameters, otherwise memory corruption can occur.

The v2.57 beta adds a check to make sure that AGS-defined functions use the right parameters in the script, after a couple of people had strange crashes due to using it wrong.

Ishmael

So I cant define dialog_request with sub-script? :P
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Gilbert

You should use the correct amount (and type) of parameters for AGS predefined function names anyway. This is for safety, otherwise you may get strange behaviours difficult to track down caused by things like memory leak, writing to a memory location which shouldn't be allowed, etc.

SMF spam blocked by CleanTalk