|
Nickolas Goodman
Registered User
Join date: 19 May 2006
Posts: 19
|
01-16-2007 07:30
Hello everyone. Can someone show me how to change this script from a touch script to a listen script? Say I want to set the channel to 3 and say the command to change to another textutre I have loaded in the contents. i.e. /3 <next texture in contents>
Thanks!
Nick
// The side of the object to display the texture on, // ALL_SIDES if all sides should display it. integer SIDE = ALL_SIDES; key owner; integer curTextureNumber = 0; default { state_entry() { owner = llGetOwner(); } touch_start(integer total_number) { integer a; key target = llDetectedKey(a); if (target = owner) { string textureName = llGetInventoryName(INVENTORY_TEXTURE, curTextureNumber); llSetTexture(textureName, SIDE); curTextureNumber++; if (curTextureNumber >= llGetInventoryNumber(INVENTORY_TEXTURE)) curTextureNumber = 0; } } }
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
01-16-2007 07:55
You will need to start a listen on the required channel in state_entry Then add a listen event handler to process the requests Look at llListen for more information.
|
|
Nickolas Goodman
Registered User
Join date: 19 May 2006
Posts: 19
|
01-16-2007 09:34
Thanks Newgate. 
|
|
Nickolas Goodman
Registered User
Join date: 19 May 2006
Posts: 19
|
01-16-2007 11:23
Can someone please tell me if there is a way to do this right. I am trying to combine the two in one if statement using AND && but the sintax is off or something. The wiki hasn't shed any more light on it. I want both to be true before it executes the rest.
Thanks!
Nick
if ((target = owner) && ( command == COMMAND_CHANGE_TEXTURE )) string textureName = llGetInventoryName(INVENTORY_TEXTURE, curTextureNumber); llSetTexture(textureName, SIDE); curTextureNumber++;
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
Brace for Impact
01-16-2007 13:17
From: Nickolas Goodman Can someone please tell me if there is a way to do this right. I am trying to combine the two in one if statement using AND && but the sintax is off or something. The wiki hasn't shed any more light on it. I want both to be true before it executes the rest.
Thanks!
Nick
A couple of things, Assuming target and owner are both being set correctly then if you are setting up your listen correctly the check for target is superflous, llListen(CHANNEL,"",llGetOwner(),""); Will listen on CHANNEL for only the owner. target == owner not target = owner And you need braces around the statements to make them into a block if ((target == owner) && ( command == COMMAND_CHANGE_TEXTURE )) { string textureName = llGetInventoryName(INVENTORY_TEXTURE, curTextureNumber); llSetTexture(textureName, SIDE); curTextureNumber++; }
|