Frictional Games Forum (read-only)
[SCRIPT] Script Syntax Help, please! - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] Script Syntax Help, please! (/thread-20100.html)



Script Syntax Help, please! - PutraenusAlivius - 01-29-2013

I'm making a map (Just for LOLZ) and i got two scripts. One will make me waking up and another unlocking a locked door. The problem is that, these two scripts both used the
PHP Code:
void OnStart() 
Syntax on the beggining! Any way to combined them both?!


RE: Script Syntax Help, please! - FlawlessHappiness - 01-29-2013

You put them inside the void OnStart() ?

Code:
void OnStart()
{
//Wake up script
//Other script
}



RE: Script Syntax Help, please! - No Author - 01-29-2013

(01-29-2013, 03:36 PM)BeeKayK Wrote: You put them inside the void OnStart() ?

I laughed at that for some reason.


RE: Script Syntax Help, please! - TheGreatCthulhu - 01-29-2013

@OP: See this to find out more how script functions integrate with the game.


RE: Script Syntax Help, please! - PutraenusAlivius - 01-30-2013

(01-29-2013, 11:11 PM)TheGreatCthulhu Wrote: @OP: See this to find out more how script functions integrate with the game.
Thanks. Sure helped me studying the HPL Editor, but the problem still exists. How do i combined them both?

@BeeKayK, i tried that and didn't work.


RE: Script Syntax Help, please! - FlawlessHappiness - 01-30-2013

Please show us your script for us to help.


RE: Script Syntax Help, please! - PutraenusAlivius - 01-30-2013

(01-30-2013, 09:59 AM)BeeKayK Wrote: Please show us your script for us to help.

Don't need to. I'm rebuilding from scratch. Lock thread?


RE: Script Syntax Help, please! - TheGreatCthulhu - 01-30-2013

A map script can have only one OnStart() function. Inside it (or inside OnEnter() ), between the { and }, you setup some initial stuff and some callbacks. Callbacks are just other (custom) functions in the code that will be called by the engine when some event of importance you "subscribed to" happens in the game. You'll probably want to add a player interact callback or something similar so that the door can be unlocked when the player clicks on them (or does something that should unlock them).

But, in order to combine the two scripts (or write it all from scratch), you'll have to have at least some basic understanding of how scripting works - so read some tutorials, and ask questions here.

And, please do show your code if you run into trouble; don't make us go look for our magic crystal ball so that we can see what you're doing wrong Wink.