Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → What's wrong with this cog?
What's wrong with this cog?
2002-11-11, 1:44 PM #1
This just completely stalled my computer. I think it should work, but it doesn't.

code:
# Jedi Knight Cog Script
#

symbols

thing console desc=console
thing td1 nolink,desc=td1
thing td2 nolink,desc=td2
thing td3 nolink,desc=td3
thing td4 nolink,desc=td4

int rounds=1 desc=rounds

flex rate=0.4 desc=rate
flex delay=8.0 desc=delay
flex health local
flex health1 local
flex health2 local
flex health3 local

int firing=0 local
int cur_round=0 local
int dummy local
int dummy1 local
int dummy2 local
int dummy3 local

template proj_tpl=+force_dest_p4

sound on_snd=Activate04.wav local

message activated

end

# ========================================================================================

code

activated:
if(firing == 1) Return;
firing = 1;
dummy = playsoundthing(on_snd,console,1.0,-1,3.0,0x0);

cur_round = 0;
while(cur_round < rounds)
{
dummy = CreateThing(proj_tpl, td1);
health = GetThingHealth(dummy);
Sleep(rate);
dummy1 = CreateThing(proj_tpl, td2);
health1 = GetThingHealth(dummy1);
Sleep(rate);
dummy2 = CreateThing(proj_tpl, td3);
health2 = GetThingHealth(dummy2);
Sleep(rate);
dummy3 = CreateThing(proj_tpl, td4);
health3 = GetThingHealth(dummy3);
Sleep(rate);
cur_round = cur_round + 1;
}

while(health + health1 + health2 + health3 > 0.0)
{
health = GetThingHealth(dummy);
health1 = GetThingHealth(dummy1);
health2 = GetThingHealth(dummy2);
health3 = GetThingHealth(dummy3);
}

sleep(delay);
firing = 0;
Return;

end

by the way,how do you put code in these things.
2002-11-11, 5:02 PM #2
"code" and "/code" [] for "".
With the cog, remove those dammed desc= and commas. Make the while loops into for loops use arrays, fireProjectile works better.
Code:
For(curRound=0; curRound <= round; curRound=curRound+1)
{
dummy[curRound] = FireProjectile(td[curRound], proj_tpl, fire sound (-1 for none), -1, '0 0 0', '0 0 0', 1, 0, 0, 0);
Sleep(rate);
}

For the second while loop.
Code:
while(dummy + dummy1 + dummy2 + dummy3 > -1){}

That cleans up most of it, but the second while loop should be scrached, but its up to you.

------------------
The Sniper Missions. Current project, The Sniper Missions

The Magician Saber System.
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack

↑ Up to the top!