i have a phone with 9 digits which i have to click the right combination. i thought i was a big girl and know about scripting that i borrow from last topic in the forum - but it doens WORK.
here is the script (i copied it from the room setting)
// room script file
int sequence=0;
function hotspot4_a() {
// script for hotspot4: Interact hotspot
if (sequence == 0) sequence++;
else sequence = 0; // wrong combination, so start again
}
function hotspot1_a() {
// script for hotspot1: Interact hotspot
if (sequence == 1) sequence++;
else sequence = 0; // wrong combination, so start again
}
function hotspot7_a() {
// script for hotspot7: Interact hotspot
if (sequence == 2) sequence++;
else sequence = 0; // wrong combination, so start again
}
function hotspot5_a() {
// script for hotspot5: Interact hotspot
if (sequence == 3) sequence++;
else sequence = 0; // wrong combination, so start again
}
function hotspot10_a() {
// script for hotspot10: Interact hotspot
if (sequence == 4) sequence++;
else sequence = 0; // wrong combination, so start again
}
function hotspot8_a() {
// script for hotspot8: Interact hotspot
if (sequence == 5) sequence++;
else sequence = 0; // wrong combination, so start again
}
function hotspot3_a() {
// script for hotspot3: Interact hotspot
if (sequence == 6) { // correct combination so
AddInventory(21); // give player the phone
}
else sequence = 0; // wrong combination, so start again
}
can someone tell me what is wrong? i double checked it, semicolon, } and everything seems to be right.
thanks
dikla
Are you sure you are interacting the hotspots..?
yes i do. 7 hotspots. likd a leopard. and recheck if i worte in each hotspot the script.
Did you copy and paste all theÃ, function hotspot4_a(), function hotspot1_a() , etc., didn't you?
You can't write these functions manually (or copy&paste), but instead, for each hotspot you should add Interact interaction and choose the RunScript action. AGS then add all the empty functions itself and you can fill them with the code you need.
EDIT:
In case you already did it the right way try to put a Display command for each hotspot to check if the function is called:
// room script file
int sequence=0;
function hotspot4_a() {
// script for hotspot4: Interact hotspot
if (sequence == 0) sequence++;
else sequence = 0; // wrong combination, so start again
Display("sequence = %d", sequence);
}
function hotspot1_a() {
// script for hotspot1: Interact hotspot
if (sequence == 1) sequence++;
else sequence = 0; // wrong combination, so start again
Display("sequence = %d", sequence);
}
....
....
etc
I'll try that but of course i did not do what you suggested. i just copy and path it from the room script/ to post it. i wrote in each hotspot the script and the room editor add it itself.
i am going to try now and i will tell you!
thx dikla
Quotei just copy and path it from the room script/ to post it. i wrote in each hotspot the script and the room editor add it itself.
Then you are doing it the right way. I meant that if, for example, someone posted a script with "function hotspot1_a()" etc. you can not just copy it from the post and paste directly into your room script, but you have to create all such functions with the AGS interaction editor first.
Thank you very much. again you saved me. i dont understand how it did the trick, but it did. anyway i cant display a massage every click saying "sequesnce = 6)
so how i can correct it and say something like - you dial "5" exc, or something.
dikla
NO NEED TO ANSWER. I DID IT MYSELF.
again, thank you very much.
dikla
Do you mean it doesn't display sequece=6 when you click on the 8th hotspot?
function hotspot8_a() {
Ã, // script for hotspot8: Interact hotspot
if (sequence == 5) sequence++;
Ã, Ã, else sequence = 0; // wrong combination, so start again
Ã,Â
}
Open that hostpot Interact interaction and check if its linked with that function. Just double click on RunScript action and see if it contains the script.
Quote from: dikla on Sat 15/05/2004 21:08:33
NO NEED TO ANSWER. I DID IT MYSELF.
again, thank you very much.
dikla
EDIT: ok, no problem :)