how callbacks and advanced callbacks work

how callbacks and advanced callbacks work

Postby Batlin on Fri Dec 03, 2010 2:24 pm

The callback functions:

There are 9 of them, with the doubles removed, 7 remain :
(source: http://uodemo.joinuo.com/?title=Command_List)
    void callback(object, integer, integer);
    void shortCallback(object, integer, integer);
    void removeCallback(object, integer);
    void removeCallbackAdvanced(object, integer, integer);
    integer hasCallback(object, integer);
    integer hasCallbackAdvanced(object, integer, integer);
    void callbackAdvanced(object, integer, integer, integer);

callback, shortCallback and callbackAdvanced can be used to register a new callback. This is the definition of callbackAdvanced: callbackAdvanced(object Item, int Ticks, int FunctionID, int CallbackID). callback and shortCallback default to calling callbackAdvanced with a function ID of 5. The difference between callback and shortCallback is that shortCallback uses ticks whereas callback uses seconds as a parameter. callbackAdvanced also works with ticks. You convert seconds to ticks by multiplying the value with 4. (see http://forum.joinuo.com/viewtopic.php?f=32&t=535)

The function ID tells the core (uodemo.exe) what to do when the callback is triggered. The FunctionID should never be 0, it should be a number between 1 and 20, any other value will cause a big crash. You have been warned. This is a screenshot of the function list inside the EXE:
Callback Function List.png
Callback Function List.png (17.98 KiB) Viewed 56 times
Knowing what the exact purpuse is of the 20 different function ID's will require more research! I have identified 2 for you already (see screenshot).

If the callback has been triggered the callback will be automatically removed. This results in a full restart of the callback if it was already active.

When you register a new callback, any existing callback with both the same function id and callback ID will be removed.

It's important to note that not all callbacks will be saved (into dynamic0):
CallbackCanBeSaved.png
CallbackCanBeSaved.png (16.01 KiB) Viewed 56 times
This screenshots means in human language: callbacks with a function ID of 7, 10, 11 will not be saved.

I hope this post answers some questions...
<Derrick> RunUO AI is kind of a functional prototype, which i have hacked into something resembling OSI behavior, but only by complitcating everything
Batlin
Site Admin
 
Posts: 306
Joined: Wed Apr 08, 2009 6:35 am


Return to UO Demo

Who is online

Users browsing this forum: No registered users and 1 guest