Results 1 to 5 of 5
  1. #1

    Exclamation Unrealscript Events question

    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

  2. #2
    Prisoner 849
    Join Date
    Nov 2007
    Location
    0,0,0
    Posts
    913
    Gamer IDs

    Gamertag: BobGneu

    Default

    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

  3. #3

    Default

    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#:

    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!"
    }

    }
    Is there something similar to event driven programming in UnrealScript?
    Last edited by JesseClark; 09-05-2011 at 06:53 PM.

  4. #4
    Prisoner 849
    Join Date
    Nov 2007
    Location
    0,0,0
    Posts
    913
    Gamer IDs

    Gamertag: BobGneu

    Default

    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

  5. #5
    Technical Writer - UDN
    Join Date
    Aug 2006
    Posts
    3,820
    Gamer IDs

    Gamertag: ffejnosliw

    Default

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.