Question about union script

Forum for alternative clients, mods & discussions on the same.

Moderator: Phades

Question about union script

Postby ItsJustMe » Tue May 20, 2014 5:37 pm

So i just started creating some scripts and i'm trying to get a sort of own menu ready.

Setting up a window is rather easy done with:
Code: Select all
var Test = jGUIWindow(jCoord(10,10), jCoord(100,100), "Test");


and getting a button also.

but how do i get a button listener that fires onclick?

thx for your help
ItsJustMe
 
Posts: 5
Joined: Thu Feb 13, 2014 10:51 am

Re: Question about union script

Postby Lordtimo » Tue May 20, 2014 5:46 pm

If you mean that the bot does smth if you click a button then this is how you wanna do it:

Code: Select all
var blist = ["Button1", "Button2","Exit"];
var selectWindow = jGUIWindow(jCoord(250, 250), jCoord(215, 160), "MyFirstBot");
var label = jGUILabel(selectWindow, jCoord(65, 5), "Buttons:");

jGUIButton(selectWindow, jCoord(55, 25), 100, blist[0]); // Button1
jGUIButton(selectWindow, jCoord(55, 50), 100, blist[1]); // Button2
jGUIButton(selectWindow, jCoord(55, 75), 100, blist[2]); // Exit

selectWindow.toggleCloseButton();
var btext = selectWindow.waitButtonClick();

if (btext == blist[0]) {
      selectWindow.destroy();
      //"doShitForButton1();"
   }
   if (btext == blist[1]) {
      selectWindow.destroy();
      //"doShitForButton2();"
   }
if (btext == blist[2]) {
      selectWindow.destroy();
      return;
   }
selectWindow.destroy();
User avatar
Lordtimo
 
Posts: 437
Joined: Wed Jun 01, 2011 12:00 pm

Re: Question about union script

Postby ItsJustMe » Tue May 20, 2014 5:51 pm

Lordtimo wrote:If you mean that the bot does smth if you click a button then this is how you wanna do it:


thx a lot
was exactly what i was looking for
ItsJustMe
 
Posts: 5
Joined: Thu Feb 13, 2014 10:51 am

Re: Question about union script

Postby Lordtimo » Tue May 20, 2014 6:06 pm

No problem, guess this can be closed then.
User avatar
Lordtimo
 
Posts: 437
Joined: Wed Jun 01, 2011 12:00 pm


Return to The Wizards' Tower

Who is online

Users browsing this forum: No registered users and 6 guests