want to move a object to one point in the room and back to the same place it was when you click on it
// script for Object 1 (Poster): Look at object // just experment
int pos1;
int pos2;
if (pos1==0) {
object[1].SetPosition(438, 111);
pos1=1;
}
if (pos1==1) {
object[1].SetPosition(379, 118);
pos1=0;
}
Try this:
// script for Object 1 (Poster): Look at object
int pos1;
int pos2;
if (pos1 == 0) {
object[1].SetPosition(438, 111);
}
if (pos1 == 1 ) {
object[1].SetPosition(379, 118);
}
if (pos1 < 1) {
pos1 += 1;
}
if (pos1 == 1)
pos1 == 0;
}
the code Didnt work :(
and this part of the code didnt compile it said undefine sysmbol pos
if (pos 1 == 1)
pos 1 == 0;
}
Didn't really look into whether the codes work or not, but:
if (pos1 == 1)
Ã, pos1 = 0;
}
Remember: double '=' is for comparison while single '=' is for assignment, also no space is allowed in variable names.
Edit: Okay, just read your original post, your original codes should sorta work (not Creator's "workaround") , but with some ammendments:
Move the two variable declaration lines OUTSIDE of the "look at object" function, but move them to the top of that room's script instead (otherwise they'll be redeclared and reset whenever the interaction is run). The pos2 variable is not used in your poted codes though (unless it's to be used somewhere else). So:
int pos1=0;
int pos2=0;
Also:
// script for Object 1 (Poster): Look at objectÃ, // just experment
if (pos1==0) {
object[1].SetPosition(438, 111);
pos1=1;
} else if (pos1==1) {
object[1].SetPosition(379, 118);
pos1=0;
}
(If you didn't add the 'else' the 'if (pos1==1)' part will always be executed)
Code worked thank you guys