This is a cog that handles a train to move to different stations (frames) and want to make it open/close doors. How can I make the keys work? These keys just don't seem to work... (The train still start and stop correctly)
------------------
"...and may the Force be with you."
-Luke Skywalker
Dark Luke, known for dressed like Vader (But no helmets and computer stuffs on), ignites his green lightsaber, ready to fight against evil and defend the light side.
Zone name: Deedlit6
Jedi vs. Sith - Dark Luke's Jedi Knight web site: Informations, addons, etc.
Code:
symbols
message startup
message arrived
message timer
thing elevator local //linkid=1
thing nananah local
template whatt
thing elevator2
float start_wait=1.5
float sleeptime=2.0
float speed=4.0
keyframe opendoor1
keyframe closedoor1
int frame1
int frame2
int frame3
int frame4
int frame5
int frame6
int frame7
int frame8
int frame9
int frame10
int nextt local
int abcde1 = 0 local
int stations = 1
end
## Code Section
code
startup:
// if (IsThingMoving(elevator)) return;
// if (GetCurFrame(elevator) != 0) return;
// if (GetSenderId() != 1) return;
//Make train
elevator = creatething(whatt, elevator2);
capturething(elevator);
clearthingflags(elevator, 0x8);
setactorflags(elevator, 0x4);
setheadlightintensity(elevator, 3);
Sleep(start_wait); // pause before moving up
print("Elevator2 loaded");
// nananah = CreateThing(ghost, elevator);
playkey(elevator, opendoor1, 1, 4);
MoveToFrame(elevator, frame1, speed);
return;
arrived:
// if (GetCurFrame(elevator) == frame[abcde1]) return;
jkStringConcatAsciiString("Arrived to frame ");
jkStringConcatInt(abcde1 + 1);
jkStringOutput();
jkStringClear();
abcde1 = abcde1 + 1;
playkey(elevator, closedoor1, 1, 4);
if (stations != abcdel) SetTimer(sleeptime);
if (stations == abcde1)
{
print("reachedlastframe");
abcde1 = 0;
Sleep(sleeptime);
// MoveToFrame(elevator, 0, speed);
// StopThing(elevator);
destroything(elevator);
Sleep(0.5);
elevator = creatething(whatt, elevator2); //TeleportThing(elevator, ghost1);
capturething(elevator);
clearthingflags(elevator, 0x8);
setactorflags(elevator, 0x4);
setheadlightintensity(elevator, 3);
settimer(sleeptime);
return;
}
print("elevator arrived");
return;
timer:
nextt = abcde1 + 1;
print("closing doors");
playkey(elevator, opendoor1, 1, 4);
sleep(1);
if (nextt == 1) MoveToFrame(elevator, frame1, speed);
if (nextt == 2) MoveToFrame(elevator, frame2, speed);
if (nextt == 3) MoveToFrame(elevator, frame3, speed);
if (nextt == 4) MoveToFrame(elevator, frame4, speed);
if (nextt == 5) MoveToFrame(elevator, frame5, speed);
if (nextt == 6) MoveToFrame(elevator, frame6, speed);
if (nextt == 7) MoveToFrame(elevator, frame7, speed);
if (nextt == 8) MoveToFrame(elevator, frame8, speed);
if (nextt == 9) MoveToFrame(elevator, frame9, speed);
if (nextt == 10) MoveToFrame(elevator, frame10, speed);
print("elevator moving");
jkStringConcatAsciiString("To frame ");
jkStringConcatInt(abcde1 + 1);
jkStringOutput();
jkStringClear();
return;
end------------------
"...and may the Force be with you."
-Luke Skywalker
Dark Luke, known for dressed like Vader (But no helmets and computer stuffs on), ignites his green lightsaber, ready to fight against evil and defend the light side.
Zone name: Deedlit6
Jedi vs. Sith - Dark Luke's Jedi Knight web site: Informations, addons, etc.
(Draws his undead great sword out, and with a variety of magical spells, gets ready to fight.
Music composer (presented as Undead Knight and maker of JK SP projects - download soundtrack of Dark Emperor 2 here!
Jedi vs. Sith - Dark Luke's Jedi Knight web site: Informations, addons, etc.
Music composer (presented as Undead Knight and maker of JK SP projects - download soundtrack of Dark Emperor 2 here!
Jedi vs. Sith - Dark Luke's Jedi Knight web site: Informations, addons, etc.