Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Callback Function Usage?
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#2
RE: Callback Function Usage?

Using the generic CallbackFunc is basically a single callback for multiple events. It's ran for every event that is listed, like Break, OnPickup, OnIgnite etc, but not all of these apply to all objects.

If you want only OnPickup, just check for it at the start of the function.

PHP Code: (Select All)
void OnStart()
{
    
SetEntityCallbackFunc("entity""MyFunc");
}

void MyFunc(string &in asEntitystring &in asType)
{
    if(
asType == "OnPickup")
    {
        
SetMessage("Messages""NoteMessage"0);
    }


Similarly you can check for other types of events.

(This post was last modified: 12-13-2017, 09:08 PM by Mudbill.)
12-13-2017, 09:07 PM
Find


Messages In This Thread
Callback Function Usage? - by Verkehr - 12-13-2017, 06:36 PM
RE: Callback Function Usage? - by Mudbill - 12-13-2017, 09:07 PM
RE: Callback Function Usage? - by Verkehr - 12-14-2017, 07:23 PM
RE: Callback Function Usage? - by Mudbill - 12-14-2017, 11:14 PM



Users browsing this thread: 1 Guest(s)