|
JohnLe Fukai
Registered User
Join date: 31 Aug 2006
Posts: 6
|
05-29-2007 11:23
Hi, i am making an item with a lot of dialog boxes WITH the same word on (STOP) to do a function. On clicking i would like it to do it's function and open the SAME dialog box again (so the user can carry on playing). i am using an "if/else if" but the condition (message=STOP) is met on the first one, so opening the wrong dialog (using effectzItemsPageOne even if on the second page dialog) . Is there a way to specific the list, something like: if(message=STOP AND the list is effectzItemsPageOne){open dialog with effectzItemsPageOne} else if(message=STOP AND the list is effectzItemsPageTwo){open dialog with effectzItemsPageTwo}
list effectzItemsPageOne=["< Back","STOP","More >","Fire"]; list effectzItemsPageTwo=["< Back","STOP","More >","Sparkler"]; list effectzItemsPageThr=["< Back","STOP","More >","Breadcrumb"]; string setParticleText="Pick your particle effect:"; integer channel=360;
effectsOff() { llParticleSystem([]); return; }
default { state_entry() { llListen(channel,"",llGetOwner(),""); }
touch_start(integer total_number) { llDialog(llDetectedKey(0),setParticleText,effectzItemsPageOne,channel); } listen(integer channel,string name,key id,string message) { if(message=llList2String(effectzItemsPageOne,1)) { effectsOff(); llDialog(id,setParticleText,effectzItemsPageOne,channel); } else if(message=llList2String(effectzItemsPageTwo,1)) { effectsOff(); llDialog(id,setParticleText,effectzItemsPageTwo,channel); } else if(message=llList2String(effectzItemsPageThr,1)) { effectsOff(); llDialog(id,setParticleText,effectzItemsPageThr,channel); } } }
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
05-29-2007 11:44
In answer to your question, you need to keep track of which dialog is being manipulated. may find it easier to chnage to a specific state to handle each one.
Your code as posted wont work , use == not = for equality tests.
_____________________
I'm back......
|
|
Shadow Subagja
Registered User
Join date: 29 Apr 2007
Posts: 354
|
05-29-2007 13:44
I'd just create a new state for each dialog, each one can have its own listen() so you can look for results from the appropriate menu and switch states to reflect which menu was last invoked, that way you can have as many repeated items as possible and not have to try and remember the information that using states can provide for free.
Also, to reduce lag you can invoke listen() only when touched, and remove the listener when the game is done (or it will be listening forever).
And as a backup to prevent getting in the wrong state, you can always set a timer for a reasonably large time that will put you back to the default state, remove listener, etc, and continuately refresh it while they play so it will ensure that if anything goes wrong (they crash mid-game or tp away) it will sort itself out for the next person.
Cheers, S
|