Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: InCreator on Sat 19/06/2004 23:46:22

Title: How to automatize scripts?
Post by: InCreator on Sat 19/06/2004 23:46:22
Like, I have some frequently used animations, such as picking something up or - to be more specific - one of character grabs his head and shakes it when other character does something stupid.
Now, I wish to know is there any possibilty to write needed commands somewhere once and declare own quick-function to remotely perform those actions, something like

GrabHead(EGO);
PickFromGround(EGO);

...or even without passed variables - beacuse they are not so badly needed, such as

Grabhead;
PickFromGround;

Or something as simple as that? Copy-pasteing needed commands will sink me into code - makes things really long and confusing.
Title: Re: How to automatize scripts?
Post by: Ashen on Sun 20/06/2004 00:04:52
Couldn't you just create them as custom functions?
So, in the global script you'd have something like:

function GrabHead(); {
  SetCharacterView (EGO, GRABVIEW);
  AnimateCharacter (EGO, 0, 3, 0);
  SetCharacterView (EGO, NORMALVIEW);
}

Then in the Script Header:

import function GrabHead();

I've done something similar to automate NPC inventories.
Title: Re: How to automatize scripts?
Post by: InCreator on Sun 20/06/2004 00:08:47
Thank you!  :D