Graphics

 View Only
  • 1.  Using/setting xpEngine as a global reference in Global Script Methods Editor

    Posted 02-05-2024 08:48

    I'd like to declare and set a global xpEngine object to use in my global scripts file. I don't want to instantiate a new engine, just grab the reference for it so I don't have to pass the `Engine` ref as a parameter to nearly every function.

    The closest I've gotten is to call a "SetPublic" function at the start of every event but that kind of defeats the purpose a bit, ideally it should be contained to the global scripts entirely. Any ideas?

    Pictured below is the "SetPublic" method

    And this is how I'd like it to work





    ------------------------------
    Tim Lundberg
    ------------------------------


  • 2.  RE: Using/setting xpEngine as a global reference in Global Script Methods Editor

    Posted 7 days ago

    I'm trying to do exactly the same thing you are. It's a small thing but since "print" debugging is about all we have, I use it a lot and the extra typing time adds up (as well as remembering the , 0 on the end). I haven't found a solution yet though, a way to retrieve the active engine (the one provided in all the project functions) from the global script. Or more directly I guess, a way to just call debugMessage directly instead of as a function on Engine.

    print("Hello")

    is just way easier than

    engine.DebugMessage("Hello", 0)

    when you're typing that dozens or potentially hundreds of times a day.

    For now the best I can come up with is a slightly shorter global function called like msg(engine, "Hello")

    ------------------------------
    - Ben
    ------------------------------