SOLVED: MIA - Object-Script Links and Rep_Ex_Always

Started by Baron, Thu 04/08/2011 18:42:51

Previous topic - Next topic

Baron

Greetings Technocrats,
     I'm working with version 3.2.1, the one containing some of those marvelous open-source updates.  In general I offer praise and adulation to all involved.
     In some small matters, however, I'm having a bit of difficulty.  Consider the following:



I have a perfectly normal object (oHorn) with a perfectly normal interaction initiated in the properties window (in this case interact object).  This results in an oHorn_interact () function you see above.  I type some code and fiddle with a bunch of other things, then try to run the game.  BAM!  Error message (above).  For the longest time I couldn't figure out why the script wasn't working.  Finally I realized that oHorn_interact () no longer appears next to interact object in the oHorn property window -my best guess is that the script has somehow become uncoupled from the (now missing) link?  The code is sound, since I've just created a new object and pasted it directly into the new object's_interact () function.  I have no recollection of having anything to do with this part of the script before the error message, so I tentatively conclude that this was not a user initiated error.  This is not a high priority since I've worked around the problem and the few bytes of memory eaten up by the now phantom oHorn will (hopefully) not impede installations by future players, but it is messy and I live in dread of such a problem cropping up on a larger scale.  Is this a bug?  And if so, is there a remedy?  Or have I done something.... goofy ::)?  In which case, I implore you to teach me better.

   Also, but unrelated..... In building Draculator II with the default template in 3.2.1 I have a pre-existing repeatedly_execute_always function in my global script.  However, in my Curses & Castles project (started in 3.1.2 SP1 and upgraded to 3.2.1) I don't (this game used the "blank" template).  I notice when creating a game in 3.1.2 SP1 there is no rep_ex_always function, but it would be rather handy to have one now.  Is there a way to upgrade into rep_ex_always, can I just manually insert it, or am I S.O.L. in this regard?

Thank you for your collective assistance.

Khris

#1
1. It looks like you accidentally replaced the function name "oHorn_Interact" in the event link with a blank space. I was able to replicate this, so it's clearly a user error, sorry ;)
This is something AGS should catch IMO, since it is impossible to spot in advance.

2. Yeah, looks like 3.2 added repeatedly_execute_always to the default Global.asc.
Just put it in there and it is called automatically.

Baron


monkey0506

For the record, any of the built-in event handlers can exist in any script (except dialog scripts which exist inside of an internally generated function):

dialog_request (probably not needed now that you can run normal scripts in dialog scripts)
game_start (doesn't work for room scripts, since no rooms are loaded yet)
on_event
on_key_press
on_mouse_click
repeatedly_execute (for rooms this must be linked through the room's Events pane, and the default name is actually room_RepExec)
repeatedly_execute_always
unhandled_event

As I said, they can exist in any script, but they're not required. If they do exist, they will be automatically called as appropriate.

SMF spam blocked by CleanTalk