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 → many ghost locations
many ghost locations
2003-02-20, 3:36 PM #1
I am making a cog that creates 50 different things at 50 different ghost locations.
Although the way i was gonna do it doesnt seem to allow for it. I was thinking of using an array but I guess I was wrong thinking you could do this with cogscript:

code

activated:
i=0;
dummy=Creatething(mything0, spot0);
call createnew;
return;

createnew:
newdummy=Creatething(mything, spot);
DestroyThing(dummy);
dummy=newdummy;
MoveToFrame(dummy, 1, speed);
WaitForStop(dummy);
i=i+1;
if (i==50) i=0;
call createnew;
Return;
end

What can i do? Plaese Helpp maaee. Playeeese Halllp.

------------------
2003-02-20, 3:45 PM #2
Here try this. I didn't test it so I'm not sure if it works.

Code:
   
activated:
	i=0;
	dummy=Creatething(mything0, spot0);
	call createnew;
	return;

createnew:
for(i=1; i<=50; i++)
{
	newdummy=Creatething(mything, spot);
	DestroyThing(dummy);
	dummy=newdummy;
	MoveToFrame(dummy, 1, speed);
 	WaitForStop(dummy);
}
	Return;
end


------------------
Sam: "Sir we can't call it 'The Enterprise'"
Jack: "Why not!"
2003-02-20, 4:20 PM #3
Bloody amateurs. [http://forums.massassi.net/html/tongue.gif]


Code:
# 02/2003 GBK
Symbols

Message Activated

Thing Spot0
Thing Spot1
Thing Spot2
Thing Spot3
Thing Spot4
Thing Spot5
Thing Spot6
Thing Spot7
Thing Spot8
Thing Spot9
Thing Spot10
Thing Spot11
Thing Spot12
Thing Spot13
Thing Spot14
Thing Spot15
Thing Spot16
Thing Spot17
Thing Spot18
Thing Spot19
Thing Spot20
Thing Spot21
Thing Spot22
Thing Spot23
Thing Spot24
Thing Spot25
Thing Spot26
Thing Spot27
Thing Spot28
Thing Spot29
Thing Spot30
Thing Spot31
Thing Spot32
Thing Spot33
Thing Spot34
Thing Spot35
Thing Spot36
Thing Spot37
Thing Spot38
Thing Spot39
Thing Spot40
Thing Spot41
Thing Spot42
Thing Spot43
Thing Spot44
Thing Spot45
Thing Spot46
Thing Spot47
Thing Spot48
Thing Spot49

Template MyThing0
Template MyThing1
Template MyThing2
Template MyThing3
Template MyThing4
Template MyThing5
Template MyThing6
Template MyThing7
Template MyThing8
Template MyThing9
Template MyThing10
Template MyThing11
Template MyThing12
Template MyThing13
Template MyThing14
Template MyThing15
Template MyThing16
Template MyThing17
Template MyThing18
Template MyThing19
Template MyThing20
Template MyThing21
Template MyThing22
Template MyThing23
Template MyThing24
Template MyThing25
Template MyThing26
Template MyThing27
Template MyThing28
Template MyThing29
Template MyThing30
Template MyThing31
Template MyThing32
Template MyThing33
Template MyThing34
Template MyThing35
Template MyThing36
Template MyThing37
Template MyThing38
Template MyThing39
Template MyThing40
Template MyThing41
Template MyThing42
Template MyThing43
Template MyThing44
Template MyThing45
Template MyThing46
Template MyThing47
Template MyThing48
Template MyThing49

Flex Speed=3

Int I=0		Local

Int L=0		Local
Thing T		Local
End
Code

Activated:
If (L) Stop;
L = 1;

While(1) {
If(T != -1) Destroything(T);
T = Creatething(MyThing0, Spot0);
Movetoframe(T, 1, Speed);
Waitforstop(T); 
I = I + 1;
If(I == 50) I = 0; }

Stop;
End


------------------
Createthingatpos(GBK, 0, '0 0 0', '0 0 0');
And when the moment is right, I'm gonna fly a kite.
2003-02-20, 5:14 PM #4
OMG! Now i see what I did wrong. Thanky.

I didn't include the "0" with the
mything0 and spot0.
I can be such a dufus sometimes.

I cant beleive you wrote all those variables out GBK!



------------------
2003-02-20, 11:59 PM #5
Actully, I didnt. The "Symbol builder" in CogPad spit that out in less than a second.


Besides, that isnt where you screwed up. You mistake was believing that JK allows calls to loop. They do not. Once youve called a message once during a run, it cant be called again. Only after the code is finished running, (has hit the final 'Return'), can the message be called again. FORs, WHILEs, Pulses and Timers are the only way to make loops.

------------------
Createthingatpos(GBK, 0, '0 0 0', '0 0 0');
And when the moment is right, I'm gonna fly a kite.
2003-02-21, 4:16 AM #6
or you can use vectors (postions) and get the corresponding sectors to create the things using something like this (this is a TCS FYI)
Code:
Activated:
   For(i=0; i<50; i++)
   {
      dummy = CreateThingAtPos(ghost, -1, spot, '0 0 0');
      sec = GetThingSector(ghost); // Get the ghost's sector, int.
      // This is for correct sector of the normal thing
      CreateThingAtPos(mything, sec, spot, '0 0 0');
      DestroyThing(dummy); // Remove the ghost
   }


That could work just as well, GBK knows about these things best.

------------------
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
2003-02-21, 8:06 AM #7
Oh I see. Well that explains it. I've got cogpad on my desktop...perhaps its time I try using it!?

I dont need to check for the sector DP because The things are always in the same sector.

------------------
2003-02-21, 10:57 AM #8
Anyone who has CogPad, redownload it... New version, less bugs, more fun.

------------------
Createthingatpos(GBK, 0, '0 0 0', '0 0 0');
And when the moment is right, I'm gonna fly a kite.
2003-02-21, 1:24 PM #9
Thanks! [http://forums.massassi.net/html/smile.gif]
Sylvicolus JK homepage
If I have ever made any valuable discoveries, it has been owing more to
patient observation than to any other reason. -Isaac Newton
2003-02-21, 1:37 PM #10
Hey, what's wrong with my cog??? [http://forums.massassi.net/html/wink.gif]
Oh, so you say I'm an amature since I forgot to have it check if the thing existed before destroying it. [http://forums.massassi.net/html/rolleyes.gif]

------------------
Sam: "Sir we can't call it 'The Enterprise'"
Jack: "Why not!"
2003-02-21, 6:10 PM #11
Quite frankly, yes. Undefined variables always equal zero, so if you desytroy "T" when it was never defined, it destroys object zero, which is usually the player. Instant crash.


But, it was a joke. We are all amateurs, none of us do this proffessionaly.

------------------
Createthingatpos(GBK, 0, '0 0 0', '0 0 0');
And when the moment is right, I'm gonna fly a kite.
2003-02-21, 10:05 PM #12
I know i was just being funny in my weird sorta way.

------------------
Sam: "Sir we can't call it 'The Enterprise'"
Jack: "Why not!"

↑ Up to the top!