I am trying to do a room where if you click open door on a door that is open then ego says "It's already open!" for example.
Vice versa with close.
Im not sure but I figure there are ways to do this without an "and" implementation into statements but why not, it'll allow more flexability.
Note: I have set as you would a flag for the door so that when it is closed you cant walk to another room or through it for that matter. Therefore when it's open, you can click on the graphic (revealed background) and walk to the corresponding room.
My example code:
// script for hotspot4: Any click on hotspot
if (UsedMode("walk to")) & (GetGlobalInt(7)==1) {
Wait(1);
}
if (UsedMode("walk to")) & (GetGlobalInt(7)==0) {
NewRoomEx(6, 150, 80);
}
if (UsedMode("open")) & (GetGlobalInt(7)==0) { // Using the LucasArts GUI Template, if I click on the door with the open command selected AND if the door flag has been set to 0 then I wont walk through it as normal instead ego will say he's already opened it, as below!
DisplaySpeech (EGO , "It's already open!");
}
no it's okay. I realised the word "while" does the same thing as "and".
My main problem now is that my code is spawning an unreasonable command loop. In my game when I choose to open the already opened door, ego decides to mutter the words "It's already open" for he's entire lifetime therefore im stuck in the game resulting in the 3 fingered solute.
Is there anything wrong with my code?
// script for hotspot4: Any click on hotspot
if (UsedMode("walk to")) while (GetGlobalInt(7)==1) {
Wait(1);
}
if (UsedMode("walk to")) while (GetGlobalInt(7)==0) {
NewRoomEx(6, 150, 80);
}
if (UsedMode("open")) while (GetGlobalInt(7)==0) {
DisplaySpeech (EGO , "It's already open!");
SetModeEx("walk to",9); // same as SetMode("walk to");
}
Im sure u guys can spot the prob alot faster than I can...
Never mind, I had myself in a tangle.
I thought about it some more and realised the open and closed flags are unessicary and there is a walk to interaction.
sorry for the used forum space ;)
cheers guys n girlz!
Edit: 1:30 AM
Still, if the AND property of a function or what not could be implemented that would be great! -Sparx yawns and falls asleep infront of the puta. zzzz
"and" is written "&&" , (it is in the manual, i think....)
In the scripting tutorial.... Part 1.