Problem with set-globalint and object remove/show.

Started by KingMick, Tue 26/10/2004 07:29:35

Previous topic - Next topic

KingMick

Hey all!  Sorry if this question is posted elsewhere--I really did search and search first before posting here, and I did not see it anywhere.  I appreciate any help anyone can offer.

Obviously I am new to AGS.  To clarify the following problem, I have not used any script-coding in this game other than the dialog scripting.  Everything I did was through the graphic interface that comes with AGS.  My problem situation is that I want an object to become visible (and interact-able) in one room after the player says a certain thing in a conversation in a DIFFERENT room.  My method for doing this was (a) not have the "Initially visible" box checked for the object, (b) used "set-globalint 1 2" in the appropriate place in the dialog script, and (c) in the object's room, putting a "Conditional - Variable 1 = 2" thingy under "Player enters room (before fadeout)", and then "Switch object back on" as the child action for the conditional.  I hope all that made sense, it's hard for me to describe it all without visually demonstrating.

The object did start out invisible as planned, but the problem happened after having the other-room conversation and selecting the appropriate option.  At this point the object was supposed to become available in its room, but it did NOT.  I have checked and rechecked the obvious possible problems--set-globalint is definitely under the correct topic option, I definitely referred to Variable 1 as having a value of 2 in both cases, etc. etc.

Based on trial-and-error testing with the object, I think the problem lies in the dialog scripting or the variable itself somehow.

Can anyone tell me what I am doing wrong or offer possibilities?  Or if not, can anyone tell me an alternative way to accomplish what I'm trying to do here?

Thanks in advance to anyone who actually reads this whole thing and comments!

Gilbert

That's because the globalints set in the dialog script is accessible only via text scripts, the variables created in the interaction editor are different things, and I think currently you cant check the values of a global int directly from interaction commands, so you need to use text scripting.

To do this, just like you did, in the object's room,  under "Player enters room (before fadeout)", set it to "Run script", then hit the "Edit Script..." button, put the following lines into the script:

if (GetGlobalInt(1)==2) ObjectOn(3); //if that object is #3, syubstitute the correct number.

save and test your game.

KingMick

Ahhhhh!  Different sets of variables!  Thank you, that's the missing piece, and it never even occurred to me.  Attempting your solution now... hmmm, I am still having the same problem, the object is still not there.

I don't know anything about the scripting language--all I did was copy/paste your line and change the object # to 0, which is the number of the object in question.  Is there something else I need to do?  I tried adding "return", having programmed a bit in Java and C++ in my time, but that gave me an error.

strazer

You have removed the "Conditional - Variable 1 = 2" before adding the "Run script" action, yes?

Gilbert

Also, make sure that yous use double equality sign '==' for comparison.

KingMick

Thanks--it looks like it is working after all now!  I appreciate the help guys, and I'll be sure to post in these forums again if I bump into any more obstacles.

SMF spam blocked by CleanTalk