Greetings, i've a few questions about uc events:
1. How can i listen an event, from another script?
2. How can i listen an event from Native Dll?
Thank you![]()
Greetings, i've a few questions about uc events:
1. How can i listen an event, from another script?
2. How can i listen an event from Native Dll?
Thank you![]()
Events are just like functions, once you get into unrealscript land. The only difference is that they are typically executed from native unreal engine code. To call a function in a different class, get an instance of it (unless it is static) and execute it with the appropriate parameters.
My comment has a link to the unrealscript reference.
I am not aware of a way to directly execute an unrealscript function using DLLBind, i believe it is one way. You can return a value and trigger it from within unrealscript though.
DLLBind
About Me | My Blog | Solarity
TechnicalHome | ScaleformTechnicalGuide | UnrealScriptReference | ReplicationHome | MasteringUnrealScriptBaptismByFire
Kismet makes sense to me when i 'read' it seeming mostly logic based
Hmm...i know how events works in C#, and now i'm trying to understand how it works in UnrealScript.
For example, how they works in C#:
Is there something similar to event driven programming in UnrealScript?class A
{
public static event Action<string> OnButtonClicked;
//Doing something in this class, and then calling the function below
private static void FireEvent()
{
InvokeEvent(OnButtonClicked, "Hey, Otacon!");
}
}
class B
{
public B()
{
//Subscribing to event
A.OnButtonClicked += OnEventFired;
}
private void OnEventFired(string msg)
{
Console.Write(msg); // And here will be "Hey, Otacon!"
}
}
Last edited by JesseClark; 09-05-2011 at 06:53 PM.
UnrealScript is EventDriven. As i said above, the events are functions in unrealscript which are executed from native unreal engine code. You do not have access to them and cannot make any new ones. All events are simply functions in unrealscript.
In C# those are simply functions executed by internal code (such as the onclick events and so forth). There is nothing special about them beyond that. You can drive your game with "events" as you wish.
About Me | My Blog | Solarity
TechnicalHome | ScaleformTechnicalGuide | UnrealScriptReference | ReplicationHome | MasteringUnrealScriptBaptismByFire
Kismet makes sense to me when i 'read' it seeming mostly logic based
I think what you want are Delegates. Events in UnrealScript are, as Bob stated, simply functions that can be called from native code. In UnrealScript, they behave exactly the same as any other function. Delegates are more like events in C# where you can assign a function in one class to a delegate in another and that function will be executed when the delegate is.
Bookmarks