Frictional Games Forum (read-only)

Full Version: Scripting question
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Could someone explain what
(string &in asParent, string &in asChild, int alState) means. Surprisingly I have been writing my own code, even though I don't actually understand it. So what exactly is "string &in asParent" etc... I have an idea of what it might be, but I still can't grasp it.
(string &in asParent, string &in asChild, int alState)

These are the parameters of a function. A function receives parameters and does something with them.

Void functionadd(int a, int b, int x) /// int describes the type of data in this case integer or a normal number, "a", "x" and "b" are the names of the numbers)
{
x=a+b; //adds "a" and "b" and places that value in "x"
}

If for example you called: "functionadd(5,4,x);"
x would become 9.

So basically your function receives 3 parameters:
string &in asParent //a text that identifies the parent ("player" for example) | string==text
string &in asChild //a text that identifies the child ("key1" for example)
int alState //a number that identifies the state (state "1","2", etc) | int==number
As to what the function does depends on the description. Probably something to change the parent or the child when they interact/collide.
(10-06-2010, 07:34 PM)HakePT Wrote: [ -> ](string &in asParent, string &in asChild, int alState)

These are the parameters of a function. A function receives parameters and does something with them.

Void functionadd(int a, int b, int x) /// int describes the type of data in this case integer or a normal number, "a", "x" and "b" are the names of the numbers)
{
x=a+b; //adds "a" and "b" and places that value in "x"
}

If for example you called: "functionadd(5,4,x);"
x would become 9.

So basically your function receives 3 parameters:
string &in asParent //a text that identifies the parent ("player" for example) | string==text
string &in asChild //a text that identifies the child ("key1" for example)
int alState //a number that identifies the state (state "1","2", etc) | int==number
As to what the function does depends on the description. Probably something to change the parent or the child when they interact/collide.

I really think we need a tutorial for this syntax-related stuff, beginners will love it!
(10-06-2010, 07:34 PM)HakePT Wrote: [ -> ](string &in asParent, string &in asChild, int alState)

These are the parameters of a function. A function receives parameters and does something with them.

Void functionadd(int a, int b, int x) /// int describes the type of data in this case integer or a normal number, "a", "x" and "b" are the names of the numbers)
{
x=a+b; //adds "a" and "b" and places that value in "x"
}

If for example you called: "functionadd(5,4,x);"
x would become 9.

So basically your function receives 3 parameters:
string &in asParent //a text that identifies the parent ("player" for example) | string==text
string &in asChild //a text that identifies the child ("key1" for example)
int alState //a number that identifies the state (state "1","2", etc) | int==number
As to what the function does depends on the description. Probably something to change the parent or the child when they interact/collide.

Thanks Smile

And off topic.. Did anyone else see what Frictional named the brutes in 15_prison_south..

"im_in_a_bad_mood"
"im_just_cute_and_happy"

xD
Tutorials for this stuff..? Yes please!

Such an endeavour would be greatly appreciated.

Especially if such tutorials were accompanied by simple sample maps and scripts that aren't overwhelmed with detail and are straight to the point. Say, for example, a simple box map containing just a locked door and a key; accompanied with a script that demonstrates how the key is picked up and placed into the inventory and then used to open the door.
You can't really make your game scary if you don't know how to script... maybe they are just waiting for you guys to actually make your places and then to get the scripting tutorials... I'd love it to see some more video tutorials.
I would really like a decent API =) At the moment I use quite a bit of trial and error to understand exactly how some of the internal functions behave.
If you want tutorials, you pretty much need to learn C++. The language is pretty much the same. Then, all you have to do is use the functions given by the engine.