Weird script method evaluation

Wed 3. Apr 2019, 20:18

Hi,

I started learning Articy:draft with the intention of integrating it into my content pipeline of my custom game engine. For this, I would need to be able to call native code functions from articy scripts and so I started looking at what the exported data looks like for some simple scripts. I put the following code into a condition node in a flow tree.

Code: Select all
equalityTest() == getObj("test") || getObj("test") == equalityTest2() || selfTest(self) || objTest(getObj("test"))


The methods equalityTest(), equalityTest2(), selfTest() and objTest() would obviously need to be implemented on the game engine side. I would expect them all to return or accept an argument of the same type, an object reference.

However, when looking at the output of the json export, this is what Articy gives me:

Code: Select all
{
  "Name": "equalityTest",
  "ReturnType": "string"
},
{
  "Name": "equalityTest2",
  "ReturnType": "ArticyObject"
},
{
  "Name": "selfTest",
  "ReturnType": "bool",
  "Parameters": [
    {
      "Param": "aParam0",
      "Type": "ArticyObject"
    }
  ]
},
{
  "Name": "objTest",
  "ReturnType": "bool",
  "Parameters": [
    {
      "Param": "aParam0",
      "Type": "object"
    }
  ]
}


Two of the methods treat the data as an "ArticyObject", one as an "object" and one as a string(!). What is going on here? Shouldn't they all be the same kind of object reference? Am I missing something? Especially the fact that the two equalityTests return different types is a bit worrying as the only difference between them is the order of the calls.

Then a few random questions:

Is there a script reference somewhere? Eg. a list of all methods supported by the scripting system? So far I have seen getProp(), setProp(), getObj(), random() and print(). I guess these only really make sense in Articy itself as the game engine is free to do whatever it wants with the script code, but still it would be nice to know what methods are supposed to be "supported".

If I implement more methods on the game engine side, is it possible to expose those to Articy to have them show up in the autocompletion drop-down menus?

Cheers!
unvestigate
 
Posts: 3
Joined: Wed 3. Apr 2019, 20:05

Re: Weird script method evaluation

Thu 4. Apr 2019, 16:11

Hi unvestigate,

Thanks for reporting this bug.
Just to explain what is going on there: One “problem” is, that basically the return value of getObj can be treated as a string. Because we don’t have a variable type for objects in articy scripts, object references can be stored in string variables.
Nevertheless, the behaviour you experience, especially with equalityTest and equalityTest2, doesn’t look intended and we have to take a closer look at it.

Regarding your other questions:
1. We have the methods documented for our Unity plugin here, but there are not other methods than the ones you have already discovered.
2. Unfortunately, it is not possible to show custom methods in the autocompletion.


Best regards,

Christian
User avatar
[Articy] Christian Schildt
Articy Staff
Articy Staff
 
Posts: 59
Joined: Tue 16. Jan 2018, 17:03
Location: Bochum

Re: Weird script method evaluation

Thu 4. Apr 2019, 18:01

Hi,

Thanks for the info. This is not a dealbreaker for me but it does indeed look a little fishy. Out of curiosity, is there a difference between "ArticyObject" and "object" in this case?

As a feature request/suggestion it would be nice if we could define the script methods we are going to expose via our game engines and give default return values for the methods with return values so that Articy could simulate them properly in the simulation mode. That way we could unambiguously list all methods, their parameters and types and Articy could show them in the autocompletion as well. Bonus points if you could allow us to group our methods into namespaces, like global variables.

Eg. I could somehow let Articy know that I have a method called PlayerTracker.IsInsideTrigger() which takes an object reference as a parameter and returns a bool. That way Articy could give me autocompletion and throw up an error if I try to pass an integer to it or use its return value as a string.

Cheers!
unvestigate
 
Posts: 3
Joined: Wed 3. Apr 2019, 20:05

Re: Weird script method evaluation

Fri 5. Apr 2019, 15:41

Hi unvestigate,

In general, “object” can be of any type found in articy scripts. But in this specific case there shouldn’t be a difference between ArticyObject and object, because the object should be an ArticyObject.

We keep your feature request in mind, but we will not be able to do it in the near future.


Best regards,

Christian
User avatar
[Articy] Christian Schildt
Articy Staff
Articy Staff
 
Posts: 59
Joined: Tue 16. Jan 2018, 17:03
Location: Bochum

Return to Technical Discussion

Who is online

Users browsing this forum: No registered users and 8 guests

Who We Are
Contact Us
Social Links