Shockaz
08-18-2004, 01:28 PM
The original coding was by Edward, but I made a few modifications to it, and now the cog doesn't work the way I want it to. Basically, when a player steps on a switch, nothing happens, but when the other player steps on the other switch, the stairs should be moving to their 2nd frame. The problem is that the stairs go to their 2nd frame when one player steps on a switch. Why does it do this, and how do I fix it?
symbols
message startup
message entered
message exited
thing switch1
thing switch2
thing stair01
thing stair02
thing stair03
thing stair04
thing stair05
thing stair06
thing stair07
thing stair08
thing stair09
int status=0 local
flex speed=1
end
#---------------------------
code
#---------------------------
startup:
MoveToFrame(stair01, 0, 100);
MoveToFrame(stair02, 0, 100);
MoveToFrame(stair03, 0, 100);
MoveToFrame(stair04, 0, 100);
MoveToFrame(stair05, 0, 100);
MoveToFrame(stair06, 0, 100);
MoveToFrame(stair07, 0, 100);
MoveToFrame(stair08, 0, 100);
MoveToFrame(stair09, 0, 100);
return;
#---------------------------
entered:
if((GetSenderRef() == switch1) && (status == 0 || status == 2))
status = status + 1;
else if((GetSenderRef() == switch2) && (status == 0 || status == 1))
status = status + 2;
else return;
if(status == 3)
MoveToFrame(stair09,1,speed);
MoveToFrame(stair08,1,speed);
MoveToFrame(stair07,1,speed);
MoveToFrame(stair06,1,speed);
MoveToFrame(stair05,1,speed);
MoveToFrame(stair04,1,speed);
MoveToFrame(stair03,1,speed);
MoveToFrame(stair02,1,speed);
MoveToFrame(stair01,1,speed);
return;
#---------------------------
exited:
if((GetSenderRef() == switch1) && (status == 1 || status == 3))
status = status - 1;
else if((GetSenderRef() == switch2) && (status == 2 || status == 3))
status = status - 2;
else return;
MoveToFrame(stair01,0,speed);
MoveToFrame(stair02,0,speed);
MoveToFrame(stair03,0,speed);
MoveToFrame(stair04,0,speed);
MoveToFrame(stair05,0,speed);
MoveToFrame(stair06,0,speed);
MoveToFrame(stair07,0,speed);
MoveToFrame(stair08,0,speed);
MoveToFrame(stair09,0,speed);
return;
#---------------------------
end
------------------
Pumpkins are the only living organisms with triangle eyes.
symbols
message startup
message entered
message exited
thing switch1
thing switch2
thing stair01
thing stair02
thing stair03
thing stair04
thing stair05
thing stair06
thing stair07
thing stair08
thing stair09
int status=0 local
flex speed=1
end
#---------------------------
code
#---------------------------
startup:
MoveToFrame(stair01, 0, 100);
MoveToFrame(stair02, 0, 100);
MoveToFrame(stair03, 0, 100);
MoveToFrame(stair04, 0, 100);
MoveToFrame(stair05, 0, 100);
MoveToFrame(stair06, 0, 100);
MoveToFrame(stair07, 0, 100);
MoveToFrame(stair08, 0, 100);
MoveToFrame(stair09, 0, 100);
return;
#---------------------------
entered:
if((GetSenderRef() == switch1) && (status == 0 || status == 2))
status = status + 1;
else if((GetSenderRef() == switch2) && (status == 0 || status == 1))
status = status + 2;
else return;
if(status == 3)
MoveToFrame(stair09,1,speed);
MoveToFrame(stair08,1,speed);
MoveToFrame(stair07,1,speed);
MoveToFrame(stair06,1,speed);
MoveToFrame(stair05,1,speed);
MoveToFrame(stair04,1,speed);
MoveToFrame(stair03,1,speed);
MoveToFrame(stair02,1,speed);
MoveToFrame(stair01,1,speed);
return;
#---------------------------
exited:
if((GetSenderRef() == switch1) && (status == 1 || status == 3))
status = status - 1;
else if((GetSenderRef() == switch2) && (status == 2 || status == 3))
status = status - 2;
else return;
MoveToFrame(stair01,0,speed);
MoveToFrame(stair02,0,speed);
MoveToFrame(stair03,0,speed);
MoveToFrame(stair04,0,speed);
MoveToFrame(stair05,0,speed);
MoveToFrame(stair06,0,speed);
MoveToFrame(stair07,0,speed);
MoveToFrame(stair08,0,speed);
MoveToFrame(stair09,0,speed);
return;
#---------------------------
end
------------------
Pumpkins are the only living organisms with triangle eyes.