View Single Post
  #5  
Old 03-01-2021, 08:30 PM
Splose
Banned
 
Join Date: Apr 2014
Posts: 279
Default

Quote:
Originally Posted by Bytebait View Post
Ok, the following does the following, but does not 'listen' to a reply from the client. When item 147498 is clicked, its prints out "Pick True or False 'True' or 'False'.
clicking either True or False will have your character say
says 'True'
says 'False'

What am I missing to have the elsif listen to the True or False? Can it be done from an item?


Code:
sub EVENT_ITEM_CLICK {
	if($itemid == 147498){
		EVENT_SAY();
	}
} 


sub EVENT_SAY{
	if($itemid == 147498){
		$client->Message(15, "Pick True or False [" . quest::saylink("True") . "].  or [" . quest::saylink("False") . "].");
	}	
	elsif ($text=~/True/i) {
		$client->Message(15, "You picked True.");	
		quest::ding();	
	}
	elsif ($text=~/False/i) {
		$client->Message(15, "You picked False.");
		quest::ding();
		
	} 
}
You need to remove the event say and put it in global_player.pl or the player.pl in the specific zone folder you want this to work in. Its best to make the saylink silent and make a fake command for it.

Code:
	# quest::saylink("#pick true",1,"True");
	# quest::saylink("#pick false",1,"False");
	if($text=~/#pick/i) {
		my @arg = split(' ', $text);
		if($arg[1] eq "true") {
			#do something
		} elsif ($arg[1] eq "false") {
			#do something different
		} else {
			#do something else entirely
		}
	}
Reply With Quote