???i need a script for sequence. strazer help me but i sit all day long and the script does not work. i have several question:
but first here is what i need: 4 colours that only if the player press on the right sequence of colors he will get his inventory item.
what i did every color is a hotspot. i worte the script as strazer gave me but still i have some questions:
1. if i write the script in the room setting do i have to write it again in the 1st hotspot?
2. do i have to "run script" in every interact hotspot?
pls just - if it is not too hard - someone write to me the script?
hotspot 1 is red ,2 is yellow ,3 is green, and the 4th - blue - the play get an icecream (item 5).
pls tell me where to write the script (room setting or hotspot) and if i need to right it several times in all the hotspots or just in the first? or just in the room setting?
i tried so many times and so many places i am confused. thank you
dikla
Actually the room script (Room Editor/Settings/{} button) contains all the hotspot interaction functions. But these functions have to be created with the Interaction Editor first.
Ok, here it is, step by step:
- Go to Room Editor / Settings
- Press the button labelled "{ }"
- Put this in there:
int sequence=0;
- Close the window (and tell it to save)
The following you have to do for each of the 4 hotspots:
- Go to "Room Editor" / "Areas" and select "Hotspots" from the drop-down menu
- Select the hotspot
- Press the button labelled "Interaction..."
- Double-click on "Interact with hotspot"
- Select "Run script" from the drop-down menu
- Press the "Edit script..." button
- Put this in hotspot 1:
if (sequence == 0) sequence++;
else sequence = 0; // wrong combination, so start again
- If you are editing hotspot 2, put this in there:
if (sequence == 1) sequence++;
else sequence = 0; // wrong combination, so start again
- This in hotspot 3:
if (sequence == 2) sequence++;
else sequence = 0; // wrong combination, so start again
- And this in hotspot 4:
if (sequence == 3) { // correct combination so
AddInventory(5); // give player the ice cream
}
else sequence = 0; // wrong combination, so start again
- Exit and save
Sorry, can't make it any clearer than that.
It is going to be easier if you create a GUI especially for this job. Create 4 buttons, one for each colour an put this script in the function interface_click() in the global script:
int colour
if ((button==1) && (colour==0)) {
colour=1;
}
else colour=0;
if ((button==2) && (colour==1)) {
colour=2;
}
else colour=0;
if ((button==3) && (colour==2)) {
colour=3;
}
else colour=0;
if ((button==4) && (colour==3)) {
Display ("You won!!!");
AddInventory(5);
}
else colour=0;
This of course presumes that the correct order is 1,2,3,4. For another order just change the numbers in the (colour==x) part of the if clause.