|
Smithy Zeno
ownes 9 pet cacti
Join date: 3 Aug 2006
Posts: 52
|
11-26-2007 17:16
Hey all, I made this script that uses 'llDetectedLinkNumber' to detect touches within a link set without scripts in the other objects. Anyways I am trying to make it so that when you press 'up', it adds 1,000 to the total amount, and when you press down it subtracts 1,000. It compiles fine, but it doesn't work at all. When I press up, it just adds one then it will not add anything at all. If someone can get me in the right direction, that'd be great. integer DISPLAY_STRING = 204000; integer amount;
default { state_entry() { amount = 1000; llMessageLinked(LINK_SET, DISPLAY_STRING, (string)amount, ""); } touch_start(integer amount) { if(llGetLinkName(llDetectedLinkNumber(0)) == "up") { amount += 1000; llMessageLinked(LINK_SET, DISPLAY_STRING, (string)amount, ""); llSay(0, (string)amount); } if(llGetLinkName (llDetectedLinkNumber(0)) == "down") { if(amount > 1000) { amount -= 1000; llMessageLinked(LINK_SET, DISPLAY_STRING, (string)amount, ""); } } if(llGetLinkName (llDetectedLinkNumber(0)) == "submit") { llSay(0, "submit"); } } }
_____________________
-Smithy
|
|
Siann Beck
Beauty & Braiiiiinsss!
Join date: 14 Jul 2007
Posts: 140
|
11-26-2007 17:47
touch_start(integer amount) Oops! 
|
|
Kahiro Watanabe
Registered User
Join date: 28 Sep 2007
Posts: 572
|
11-27-2007 07:54
add this: on_rez(integer number) { amount = 1000; llMessageLinked(LINK_SET, DISPLAY_STRING, (string)amount, ""  ; } ------------------- An like somen said in the message above...if you have the event touch_start (integer amount) {} You are using that local variable "amount" and not the global one. so change it for touch_start (integer number) {} "number" variable counts how many people touches the object and doesn't have anything to do with amount.
|
|
Siann Beck
Beauty & Braiiiiinsss!
Join date: 14 Jul 2007
Posts: 140
|
11-27-2007 12:04
Don't be afraid to make your variable names descriptive. Generic names like "amount" and "number" could mean anything, and in a large script could take a bit of searching to figure out the context. Try something like touch_start(integer intNumDetected)
|