Jump to content

listen() within touch_start event?


Wolfy9247
 Share

You are about to reply to a thread that has been inactive for 4650 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I'm currently looking to allow the owner of this object to be able to set a certain value within a game by stating the number on a channel (such as 0) and then begin the game with that set number. Currently, I'm unsure of how to do this though with it being within the touch_start event. Currently this event is triggered by the user clicking "Set Value" on the menu of the object, setting GM_Set to true so whenever it's clicked on again the listen() is opened. This is a snippet from the coding:

else if (GM_Set & UserKey == llGetOwner())
{
llOwnerSay("Please state the amount you'd wish to set the current game to!");
llListen(PUBLIC_CHANNEL, "", llGetOwner(), "");
llSetTimerEvent(30);
if ( message == "5" )
{
llWhisper(PUBLIC_CHANNEL, "You've entered "+(string)message+"!");
countLimit = message;
CLA = message--; // Meant to be one LESS than the intended number.
Game_Mode = TRUE;
}
else llWhisper(PUBLIC_CHANNEL, "Invalid number or no input detected! Please try again!");

 

It'd be appreciated if you could give me some advice on the listen() as I'm currently stumped on this ?_?

Link to comment
Share on other sites

This, I think, is the structure you want:

integer handle;key owner;default{	state_entry()	{		owner = llGetOwner();	}	touch_start(integer total_number)	{		if(llDetectedKey(0)==owner){			llListenRemove(handle);			handle = llListen(0,"",owner,"");			llSetTimerEvent(30.0);			llOwnerSay("Please state the amount you'd wish to set the current game to!");		}	}	listen(integer channel, string name, key id, string message)	{		llListenRemove(handle);		llSetTimerEvent(0.0);		integer i = (integer)message;		if((string)i == message){//quick test for a valid integer other than 0			llOwnerSay( "You've entered "+message+"!");			//do stuff to set the appropriate value		}		else{			llOwnerSay("Sorry, but \""+message+"\" is not a valid integer. Please try again");		}	}	timer()	{		llListenRemove(handle);		llSetTimerEvent(0.0);		llOwnerSay("Sorry, timed out");	}}

 

  • Like 1
Link to comment
Share on other sites

Thanks a bunch for the structuring example- also figured out that among the other coding the if() statement didn't seem to be on top of everything else and causing it not to listen to what it was originally supposed to. Either way, it's all working now like it's supposed to. ^-^

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4650 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...