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 → Cog to cog int transfer?
Cog to cog int transfer?
2003-06-30, 3:45 AM #1
Possible? Perhaps someone have idea how?

------------------
The miners of Kiith Somtaaw sacificed much, and risked all. For their efforts they were brought into the inner most circle of Hiigaren power. Naabal, S'jet, and Sobanii bowed before them. And from that day to this, Somtaaw's children have been known to one and all as Beastslayers..
2003-06-30, 4:20 AM #2
Cog1:
Code:
SendMessageEX(cog, Message, flex, flex, flex, flex);

Cog2:
Code:
User0:
     number=GetParam(0);
     Return;
Usually when sending a message, the UserX (up to 9) message is used, though you can send any message to another cog. The GetParam(#) means to get the number in the SendMessage command. 0 is the first flex, 1 is the second, etc. You can send nearly any type of data to another cog this way: flex, int, thing, surface, sector, even cog (I think).

Hope that helps. [http://forums.massassi.net/html/biggrin.gif]

------------------
"The Just shall live by faith." - Galatians 3:11
To edit is human... To COG is divine!!

pegasus_1984: Stop bushing that dang suck button.
guitarofgold: NOOOOOOOOO!!!!
-------[end post]-------

[This message has been edited by DogSRoOL (edited June 30, 2003).]
Catloaf, meet mouseloaf.
My music
2003-06-30, 11:20 AM #3
Quote:
<font face="Verdana, Arial" size="2">You can send nearly any type of data to another cog this way: flex, int, thing, surface, sector, even cog (I think).</font>


Because, really, you have only three real types: float, int, and vector. Most types are just another name for int. And because cog will change a variable's type when it needs to, you can't tell the difference between a float and an int.

Vectors are distinctly different because they're three times the size of floats and ints. You can't use vectors with verbs SendMessageEx() because of their size.

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2003-06-30, 11:37 AM #4
but there is a way around it.
SendMessageEx(cog, message, vector x, vector y, vector z, variable);
Like that, you get a vector. To use.
VectorSet(GetParam(0), GetParam(1), GetParam(2));

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

The Magician Saber System.

The 2 riddle!
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2003-06-30, 8:33 PM #5
ok: I have 2 cogs. They dont work ..
First one is shop cog:
Code:
# Jedi Knight Missions Cog Script
#
# shopdef.cog
#
# [EH_AceTFL]
#
# 

symbols

message		activated

thing          pickup0
template       picktemp0
thing          pickup1
template       picktemp1
thing          pickup2
template       picktemp2
thing          pickup3
template       picktemp3
thing          pickup4
template       picktemp4
thing          pickup5
template       picktemp5
thing          pickup6
template       picktemp6
thing          pickup7
template       picktemp7
thing          pickup8
template       picktemp8
thing          pickup9
template       picktemp9
thing          pickup10
template       picktemp10
thing          pickup11
template       picktemp11
thing          pickup12
template       picktemp12
thing          pickup13
template       picktemp13
thing          pickup14
template       picktemp14
thing          pickup15
template       picktemp15
thing          pickup16
template       picktemp16
thing          pickup17
template       picktemp17
thing          pickup18
template       picktemp18
thing          pickup19
template       picktemp19
thing          pickup20
template       picktemp20

int pickcost0
int pickcost1
int pickcost2
int pickcost3
int pickcost4
int pickcost5
int pickcost6
int pickcost7
int pickcost8
int pickcost9
int pickcost10
int pickcost11
int pickcost12
int pickcost13
int pickcost14
int pickcost15
int pickcost16
int pickcost17
int pickcost18
int pickcost19
int pickcost20

thing		ghostcrate

surface 	addrem
surface 	value

cog		moneycog

end

code
#---------------------------------------------------------------------------------------  
activated:
if(GetSenderRef()==pickup0)
{
Setwallcel(addrem, 0);
SendMessageEx(moneycog, user3, pickcost0);
CreateThing(ghostcrate, picktemp0);
}


if(GetSenderRef()==pickup1)
{
Setwallcel(addrem, 0);
SendMessageEx(moneycog, user3, pickcost1);
CreateThing(ghostcrate, picktemp1);
}


if(GetSenderRef()==pickup2)
{
Setwallcel(addrem, 0);
SendMessageEx(moneycog, user3, pickcost2);
CreateThing(ghostcrate, picktemp2);
}


if(GetSenderRef()==pickup3)
{
Setwallcel(addrem, 0);
SendMessageEx(moneycog, user3, pickcost3);
CreateThing(ghostcrate, picktemp3);
}


if(GetSenderRef()==pickup4)
{
Setwallcel(addrem, 0);
SendMessageEx(moneycog, user3, pickcost4);
CreateThing(ghostcrate, picktemp4);
}


if(GetSenderRef()==pickup5)
{
Setwallcel(addrem, 0);
SendMessageEx(moneycog, user3, pickcost5);
CreateThing(ghostcrate, picktemp5);
}


if(GetSenderRef()==pickup6)
{
Setwallcel(addrem, 0);
SendMessageEx(moneycog, user3, pickcost6);
CreateThing(ghostcrate, picktemp6);
}


if(GetSenderRef()==pickup7)
{
Setwallcel(addrem, 0);
SendMessageEx(moneycog, user3, pickcost7);
CreateThing(ghostcrate, picktemp7);
}


if(GetSenderRef()==pickup8)
{
Setwallcel(addrem, 0);
SendMessageEx(moneycog, user3, pickcost8);
CreateThing(ghostcrate, picktemp8);
}


if(GetSenderRef()==pickup9)
{
Setwallcel(addrem, 0);
SendMessageEx(moneycog, user3, pickcost9);
CreateThing(ghostcrate, picktemp9);
}


if(GetSenderRef()==pickup10)
{
Setwallcel(addrem, 0);
SendMessageEx(moneycog, user3, pickcost10);
CreateThing(ghostcrate, picktemp10);
}


if(GetSenderRef()==pickup11)
{
Setwallcel(addrem, 0);
SendMessageEx(moneycog, user3, pickcost11);
CreateThing(ghostcrate, picktemp11);
}


if(GetSenderRef()==pickup12)
{
Setwallcel(addrem, 0);
SendMessageEx(moneycog, user3, pickcost12);
CreateThing(ghostcrate, picktemp12);
}


if(GetSenderRef()==pickup13)
{
Setwallcel(addrem, 0);
SendMessageEx(moneycog, user3, pickcost13);
CreateThing(ghostcrate, picktemp13);
}


if(GetSenderRef()==pickup14)
{
Setwallcel(addrem, 0);
SendMessageEx(moneycog, user3, pickcost14);
CreateThing(ghostcrate, picktemp14);
}


if(GetSenderRef()==pickup15)
{
Setwallcel(addrem, 0);
SendMessageEx(moneycog, user3, pickcost15);
CreateThing(ghostcrate, picktemp15);
}


if(GetSenderRef()==pickup16)
{
Setwallcel(addrem, 0);
SendMessageEx(moneycog, user3, pickcost16);
CreateThing(ghostcrate, picktemp16);
}


if(GetSenderRef()==pickup17)
{
Setwallcel(addrem, 0);
SendMessageEx(moneycog, user3, pickcost17);
CreateThing(ghostcrate, picktemp17);
}


if(GetSenderRef()==pickup18)
{
Setwallcel(addrem, 0);
SendMessageEx(moneycog, user3, pickcost18);
CreateThing(ghostcrate, picktemp18);
}


if(GetSenderRef()==pickup19)
{
Setwallcel(addrem, 0);
SendMessageEx(moneycog, user3, pickcost19);
CreateThing(ghostcrate, picktemp19);
}


if(GetSenderRef()==pickup20)
{
Setwallcel(addrem, 0);
SendMessageEx(moneycog, user3, pickcost20);
CreateThing(ghostcrate, picktemp20);
}
return;

end


second is global money cog:
Code:
 
# Jedi Knight Missions Cog Script
#
#  money.cog
#
# [EH_AceTFL]
#
# 

symbols

message		user3

int gold=700
int value local

surface 	addrem

end

code
#---------------------------------------------------------------------------------------  
user3:

if(getwallcel(addrem)==0)
{
value = GetParam(0);
gold = gold - value;
Print("You have:");
Printint(gold);
Print("money");
}

if(getwallcel(addrem)==1)
{
value = GetParam(0);
gold = gold + value;
Print("You have:");
Printint(gold);
Print("money");
}

return;

end


Someone can say me whats is wrong?

------------------
The miners of Kiith Somtaaw sacificed much, and risked all. For their efforts they were brought into the inner most circle of Hiigaren power. Naabal, S'jet, and Sobanii bowed before them. And from that day to this, Somtaaw's children have been known to one and all as Beastslayers..
2003-07-01, 3:46 AM #6
1st off man, thanks for the code tags. But by god, use arrays for the first cog! The major error I see is that you aren't have 4 parameters in teh SendMessageEx(), you need 4, no matter what, but you can call only 1 or 2. Plus money cog is undefined, so we need to define it then.
To fix the cogs.
Code:
Activated:
moneycog = GetInvCog(player, bin);
For(i=0; i<20; i=i+1)
{
   If(GetSenderRef() == pickup0)
   {
      SetWallCel(addrem, 0);
      SendMessageEx(moneycog, user3, pickcost0, 0,0,0);
      CreateThing(ghostcrate, picktemp0);
   }
}
Return;

Make sure the money is an Inv cog or you will have to use triggers. Plus, something I've found, GetWallCel() isn't a good verb, you should send the int in the second param of the SendMessageEx. Also, you should change the cogs so the gold is stored in that bin and the second cog only prints out what you have left. But you can do that however you want.

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

The Magician Saber System.

The 2 riddle!
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2003-07-01, 4:06 AM #7
grah inv, i dont know how inv should be done :/

------------------
The miners of Kiith Somtaaw sacificed much, and risked all. For their efforts they were brought into the inner most circle of Hiigaren power. Naabal, S'jet, and Sobanii bowed before them. And from that day to this, Somtaaw's children have been known to one and all as Beastslayers..
2003-07-01, 4:37 AM #8
Actually, ints take up the least amount of memory, followed by floats. I don't know exactly what a flex is, so I don't know about that. I had always assume it was a double precision floating point type instead of single precision like float. In that case, flex would take more, then of course a vector.

Say, didn't someone figure out how to make a crude string in COG a while back?

------------------
Bassoon, n. A brazen instrument into which a fool blows out his brains.
Bassoon, n. A brazen instrument into which a fool blows out his brains.
2003-07-01, 4:38 AM #9
Quote:
<font face="Verdana, Arial" size="2">Originally posted by EH_AceCSF:
grah inv, i dont know how inv should be done :/</font>


Do a search for inv in DataMaster then.

------------------
Bassoon, n. A brazen instrument into which a fool blows out his brains.
Bassoon, n. A brazen instrument into which a fool blows out his brains.
2003-07-01, 1:34 PM #10
Emon, a flex is the same thing as a float, and the same size as an int. It's a single.

And yes, Cog can handle strings after a fashion. Use jkStringConcatInt() and the '%c' format specifier. I'm pretty sure that JK uses VC++ functions to format the string - so JK is none the wiser.

I wonder if LEC ever considered that...

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2003-07-01, 1:35 PM #11
I did write all that in the DataMaster, you know. [http://forums.massassi.net/html/tongue.gif] It should be common knowledge.

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.

↑ Up to the top!