edited February 2014 in ORK Support
Hi,

Okay, this turned out to be a lengthy question so here is my basic issue first:

Can I check variables that I set in my own scripts with the event system? If not how do I use my own scripts (javascript) to set a global ORK Game Variable that can be checked in the event system?

...and here is what I have tried and why:

I am working on a 2D game where the character can walk left, right, up, and down which means I have four different walking animations and 4 different idle animations. When my character enters an event, such as a dialogue event, the player control should be blocked (this works fine through ORK) and the appropriate idle animation should play depending on which direction the character is facing.

To help with this I have my character controller script set up to change the string of a variable called walkingDirection to reflect the current direction the character is walking. If I try to check the value of this variable's string in the event system it fails every time. I think that I have tried just about every combination of settings in the event and in my scripts and I just can not get it to work. I also thought that maybe since my player controller script was being disabled by ORK when the event starts I would need a second script to hold the variable's string value, so I tried that too and it still doesn't work with the event. Below are some screenshots of my setup.

Any help would be appreciated.


image
image
image


Post edited by hankphone on
  • The Check Game Variables step wont check fields on your own scripts - it checks only ORK's game variables. You can also set game variables via script, you can find more on game variables and accessing them via script in this how-to.

    However, you can also check fields of your components using the Check Fields step (found in Function Steps). But I don't know if component will be found if it's deactivated ... so probably it's best to set an ORK Game Variable in your script directly.

    Example:
    ORK.Game.Variables.Set("walkingDirection, "wRight");
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • That is what I was sorta thinking. I have looked at the game variables how-to about a hundred times today and seem to be missing what I need to add to my scripts in order to reference anything ORK. I just get this error: Unknown identifier: 'ORK'. Sorry, I'm not a very strong programmer.
  • Ah, sorry - I probably should do a small how-to on doing this things :)

    Well, in C# you'll have to use the following line at the top of your script:

    using ORKFramework;

    In JavaScript:

    import ORKFramework;
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Ah, there she is. Thanks man.
Sign In or Register to comment.