PenUltima Online

It is currently Thu Sep 04, 2008 9:48 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Checkboxes on Gumps
PostPosted: Sun Sep 03, 2006 10:56 am 
im having a problem with Checkboxes in a gump, i iused the example stated in the gumpsdoc. But it does not work.

Code:
var choice:=SendDialogGump( who, gflayout, gfdata );
var his_choice;
foreach key in ( choice.keys )
his_choice := his_choice + key;
endforeach

if (choice[100])
   SendSysMessage(who, "Red");
   CreateItemInBackpack(who, 3172,1);
elseif
   (choice[200])
      SendSysMessage(who, "Green");
      CreateItemInBackpack(who, 3186,1);

endif
if(choice[100] && choice[200])
                SendSysMessage(who,"You combined red and green");
endif


the script works but, i want it to work separate, if i press red and green, it will create the items and stat the sysmessage, I want it so if i press red and green only the sysmessage will be shown

thnx in advance[/code]


Top
  
 
 Post subject:
PostPosted: Mon Sep 04, 2006 12:07 am 
As long as I've been working with POL, gumps are still my nemesis :P However, I see a clear problem here from what you've described.


The way you have your IFs defined, if someone selects both, they will get the 'red' item created, AND get the message saying they checked both. They shouldn't get the green item created, though.


My guess is what you really want is a radio button, not a check box... you want them to choose only ONE or the other, right? (in evidence for my gump ignorance, I ask this question: Do UO gumps HAVE radio buttons? :P )



Assuming that's what you want, but you still want to use the check boxes, you need to re-order your code a bit.

Code:
if (choice[100] && choice[200])
   SendSysMessage(who, "You chose both!");
elseif (choice[100])
   Blah...
elseif (choice[200])
   blah...
endif


Top
  
 
 Post subject:
PostPosted: Mon Sep 04, 2006 3:56 am 
I'll try that solution.

My idea was too have a gump with 3 checkboxes on it, and they could choose them seperate or together. So i.e u got 3 checkboxes called red green and blue, i want to do something if they choose Red and when they choose Red and Blue i wanna do something too. Hope that explains my question :?


Top
  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl