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 → Variables
Variables
2001-01-25, 1:48 AM #1
If you make a cog file, and put a variable in it (EG a=0) Then how do you get other cogs to recognise that variable and realise that if the variable changes (EG to 1).
2001-01-25, 5:20 AM #2
You got to pass the var onto the other cog or use a global variable, which is the

"items.dat"
"SetThingUserData"
or something else.

To pass use,
SendMessageEx(cog, message, var1, var2, var3, var4);
But this way, it's hard to retrieve the "cog" unless you specify via JED.

or add new entries in the items.dat and use
SetInv(player, 116orAbove, 1);
and
GetInv(player, 116);

or use SendTrigger
SendTrigger(-1, 123, var1, var2, var3, var4);
and in other cogs

trigger:
if(GetSourceRef() == 123)
{
sentVar1 = var1;
another = var2;
whatever = var3;
oneMore = var4;
}

The only global value is the "items.dat" method and others are passing the local var to other cogs.

And as for SetThingUserData, it can set a unique var onto a "thing" globally

SetThingUserData(player, yourValue);
and
GetThingUserData(player);
will return the value set.

------------------
http://millennium.massassi.net/ - Millennium

[This message has been edited by Hideki (edited January 25, 2001).]
2001-01-25, 9:03 AM #3
thanx- i got it to work now! [http://216.105.160.32/html/smile.gif] [http://216.105.160.32/html/smile.gif] [http://216.105.160.32/html/smile.gif]

↑ Up to the top!