Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Qwerty on Sat 19/06/2004 09:07:11

Title: Problem with script. [Solved]
Post by: Qwerty on Sat 19/06/2004 09:07:11
I cannot upload picture, so I type my hotspot interaction here:

Conditional - If inventory item was used
Run script (And script is: DisplaySpeech(GetPlayerCharacter(), "Speech...");
Object - Remove object from room (0)
Object - Remove object from room (1)
Object - Switch object back on (2)
Game - Pause processor for a set time (40)
Player - Go to a different room (at specified co-ordinates) (3, 100, 100)

Everything works ok, execept script. Player character doesn't say anything.

What is wrong?
Title: Re: Problem with script.
Post by: Estaog on Sat 19/06/2004 14:01:40
Quote from: Qwerty on Sat 19/06/2004 09:07:11
Run script (And script is: DisplaySpeech(GetPlayerCharacter(), "Speech...");

There is your problem. You have to use DisplaySpeech (Character number,Message)
See the manual for questions like these.
Title: Re: Problem with script.
Post by: strazer on Sat 19/06/2004 14:47:55
Tanker, character names return the character number as does GetPlayerCharacter. I don't see what you think is wrong with the script.

Qwerty, could you indent your list so we can see the hierarchy?
And are you sure you're using the inventory item you specified in the conditional?
Title: Re: Problem with script.
Post by: Estaog on Sat 19/06/2004 16:08:07
Yea i know that i just tough that might fix it. But then again the problem could be somewhere else.
Title: Re: Problem with script.
Post by: Qwerty on Sat 19/06/2004 18:18:03
Quote from: strazer on Sat 19/06/2004 14:47:55
Qwerty, could you indent your list so we can see the hierarchy?
And are you sure you're using the inventory item you specified in the conditional?

Ident my list? What do you mean?

Yes, I'm sure, beacuse everything else works ok.
Maybe It's a bug...?
Title: Re: Problem with script.
Post by: Ashen on Sat 19/06/2004 18:21:07
QuoteIdent my list? What do you mean?

He means like:

Conditional - If inventory item was used
  Run script (And script is: DisplaySpeech(GetPlayerCharacter(), "Speech...");
  Object - Remove object from room (0)
  Object - Remove object from room (1)
Object - Switch object back on (2)
Game - Pause processor for a set time (40)
Player - Go to a different room (at specified co-ordinates) (3, 100, 100)

So we can see what is conditional on the inventory item.
Title: Re: Problem with script.
Post by: Qwerty on Sat 19/06/2004 18:23:37
Ok, ok.

Conditional - If inventory item was used (2)
Ã,  Run script (And script is: DisplaySpeech(GetPlayerCharacter(), "Speech...");
Ã,  Object - Remove object from room (0)
Ã,  Object - Remove object from room (1)
Ã,  Object - Switch object back on (2)
Ã,  Game - Pause processor for a set time (40)
Ã,  Player - Go to a different room (at specified co-ordinates) (3, 100, 100)

And I just tested, when I take off Player - Go to a different room, it works.
But I want player changing room...
Title: Re: Problem with script.
Post by: Ashen on Sat 19/06/2004 18:28:19
What if you use the 'Game - Display a Message' interaction, instead of run script? Or use script for the whole thing?
Title: Re: Problem with script.
Post by: Qwerty on Sat 19/06/2004 18:41:39
I don't like display message interaction, it only messes up the game :P

I can try to use script for the whole thing, thanks for suggestion.

EDIT: 8) Thanks for suggestion again 8)

Now it works. Only run script:

DisplaySpeech(GetPlayerCharacter(), "Speech"); 
ObjectOff(0);
ObjectOff(1);
ObjectOn(2);
Wait(40);
NewRoomEx(3, 188, 110);

Strange, why it didn't work without script.... :o
Title: Re: Problem with script.
Post by: Scorpiorus on Sun 20/06/2004 01:20:24
It didn't work because under certain conditions the RunScript option is executed *last* regardless of actual order of interaction options. Thereby you got a Player - Go to a different room before RunScript and thus (since a player moves to another room) the RunScript option didn't have a chance to run.

That fact is rather unintuitive, I know, and the best option would be to use a single RunScript action and put all the commands there, as Ashen suggested.