Hi,
basically im using multiple scripts in 1 object
and i need to check variables from a script its not stored/defined in.
is this even possible or how would i go about it?
These forums are CLOSED. Please visit the new forums HERE
sharing variables between scripts? |
|
QueenHeather Hancroft
Registered User
Join date: 26 Sep 2008
Posts: 20
|
10-15-2009 10:15
Hi,
basically im using multiple scripts in 1 object and i need to check variables from a script its not stored/defined in. is this even possible or how would i go about it? |
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
10-15-2009 10:36
You can store variables in a prim's description. Let one script set the description and another one read it.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask....
![]() Look for my work in XStreetSL at |
Kayaker Magic
low carbonated footprint
Join date: 11 Sep 2008
Posts: 109
|
10-15-2009 11:06
You can llMessageLink between the scripts to send data back and forth.
|
Lear Cale
wordy bugger
![]() Join date: 22 Aug 2007
Posts: 3,569
|
10-15-2009 11:30
You can store variables in a prim's description. Let one script set the description and another one read it. ![]() There are other places where you can stash values, such as parameters for a prim face that's not visible. (For example, if your object is a sphere, you can make it hollow, and then it has another face. Every face has color and alpha values that you can set and get.) Using tricks like this makes the script less general-purpose, of course. And as mentioned above, llMessageLinked(), which is the main way of passing information between scripts in an object. |
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
10-15-2009 12:13
Persnickety correction: you can store VALUES in a prim's description. ![]() Touché! .... That's what I get for typing before finishing my coffee. ![]() _____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask....
![]() Look for my work in XStreetSL at |
QueenHeather Hancroft
Registered User
Join date: 26 Sep 2008
Posts: 20
|
10-15-2009 12:57
objectdesc is good idea like hippotech does,
im trying to use linked msgs now, what i need help with is. sending more than 1 peice of info. right now im only sending "tenantshome" but i would also like to include thier name in the string tenantshome|queenheather hancroft i need to know how to seperate the two when i recieve them link_message(integer sender_num, integer num, string msg, key id) { if (msg == "tenantshome" && rented == TRUE) { } |
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
10-15-2009 13:22
Your friend is llParseString2List, as in
list myNewList = llParseString2List(msg,["|"],[""]);. Then you pull your two variables, tenantshome and avName, out of the new list with llList2String, as in string tenantshome = llList2String(myNewList,0);. See http://lslwiki.net/lslwiki/wakka.php?wakka=llParseString2List and http://lslwiki.net/lslwiki/wakka.php?wakka=llList2String. _____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask....
![]() Look for my work in XStreetSL at |
Jack Abraham
Lantern By Day
Join date: 11 Apr 2008
Posts: 113
|
10-15-2009 13:24
Take a look at llParseString2List and llParseStringKeepNulls.
EDIT: And I'm beaten to the punch. : ) |
QueenHeather Hancroft
Registered User
Join date: 26 Sep 2008
Posts: 20
|
10-15-2009 13:50
problem i got now,
i check for alot of linked msgs, and usually its just oneword so unnecasery to split atall. if (msg == "tenantshome" && rented == FALSE) this line wont work because it includes more info than just "tenantshome" in the string. so how do i go about this must i seperate every string i recieve before hand because in that case ill have to compare if llList2String(myNewList,0); == MSGIMLOOKINGFOR on every single linkedmessage i recieve or would it be better to check if tenantshome is "in the string" i recieve , before splitting the msg so i dont have to do it everytime ??? thats what i need to know how to do i hope people know what i mean |
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
10-15-2009 14:26
Yup, that's exactly what you do.
CODE
ETA: You could compact all of this to CODE
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask....
![]() Look for my work in XStreetSL at |
Beverly Ultsch
Registered User
Join date: 6 Sep 2007
Posts: 229
|
10-15-2009 15:21
Or check the easy stuff first.
Something like CODE
|
QueenHeather Hancroft
Registered User
Join date: 26 Sep 2008
Posts: 20
|
10-15-2009 18:29
thanks,
if(llList2String(llParseString2List(msg,["|"],[""]),0) == "tenantshome" && rented) this is exactly what i wanted, reason being, incase i needed to use linked msgs for multiple strings. not just if "tenantshome" its been fun, bedtime now. no doubt ill be back tomorrow with bigger, better & new problems zZz |
LizardTongue Surface
Registered User
Join date: 31 May 2005
Posts: 11
|
mileage may vary
10-16-2009 20:16
The way I worked this in mine was to use the second parameter so my sending code is
CODE
|