Author Topic: Question / Help with Menu Check Command....  (Read 3156 times)

0 Members and 1 Guest are viewing this topic.

Offline AlphaTopic starter

  • Hero Member
  • *
  • Posts: 583
  • Activity:
    0%
  • Reputation Power: 10
  • Alpha barely matters.Alpha barely matters.
  • Respect: +44
  • Referrals: 0
    • View Profile
Question / Help with Menu Check Command....
« on: May 15, 2010, 02:42:42 PM »
0
If you have 2 checkboxes in a menu is it possible to make it so that checking Box 1 will UNCHECK Box 2 ???

I'm making a short script with a Menu to do specials etc.. and I have it setup so that you simply check your primary or secondary special moves...  Since you can't do both at one time I figured it would be nice to make it so that trying to check both checkboxes @ the same time was impossible..

For example..

If you have Box 1 (primary) checked & you check Box 2 (Secondary) it would then UNCHECK Box 1 and so on...   I realize that you can set menu check to #false which will indeed clear the checkbox but it appears that #menures only remembers the last ACTUAL mouseclick or some such, and even if you reset it to #False it will return #True in #menures bc that was the last "phycial" input?     Anyway running short on time ... Work etc.. but if Anyone is borred enough or already knows lemme know...  If I failed to make it very clear I'll be back later heh..

Thx in Advance.

Offline luv2luvlong

  • Sr. Member
  • *
  • Posts: 272
  • Activity:
    0%
  • Reputation Power: 4
  • luv2luvlong has no influence.
  • Gender: Male
  • Respect: +14
  • Referrals: 0
    • View Profile
Re: Question / Help with Menu Check Command....
« Reply #1 on: May 15, 2010, 02:47:30 PM »
0
Take a look at TM's CLaw.
It does that when you check "loot ground items" it unchecks "automatic corpse looting.
"If you know the enemy and know yourself, you need not fear the result of a hundred battles. If you know yourself but not the enemy, for every victory gained you will also suffer a defeat. If you know neither the enemy nor yourself, you will succumb in every battle" - Sun Tzu in reference to his five points of victory.

Offline Noobie

  • Sr. Member
  • *
  • Posts: 262
  • Activity:
    0%
  • Reputation Power: 1
  • Noobie has no influence.
  • Gender: Male
  • Respect: +13
  • Referrals: 1
    • View Profile
Re: Question / Help with Menu Check Command....
« Reply #2 on: May 15, 2010, 03:48:36 PM »
0
step through this see if it helps.
Code: [Select]
menu check Checkbox1 0 20 90 30 #false Bottles
menu check Checkbox2 0 40 90 30 #false Kegs
menu show

main:
gosub box1
gosub box2
goto main

sub box1
Menu get Checkbox1
if #MENURES = -1         ;<----- -1 = checked  0 = unchecked
{
menu delete Checkbox2
menu check Checkbox2 0 40 90 30 #false Kegs ;<--unchecked
menu show
wait 2s
}
return

sub box2
Menu get Checkbox2
if #MENURES = -1         ;<----- -1 = checked  0 = unchecked
{
menu delete Checkbox1
menu check Checkbox1 0 20 90 30 #false Bottles ;<--unchecked
menu show
wait 2s
}
return

Scrripty

  • Guest
Re: Question / Help with Menu Check Command....
« Reply #3 on: May 15, 2010, 04:55:54 PM »
0
I hope this makes sense.  This is a long way to do it, but I wanted to show a way to do what I think you were asking.  This is fully working.  Copy paste it into EUO and try it.  If you're JUST trying to turn a checkbox off if another one is on NO MATTER WHAT, and don't want it selectable at ALL if one is clicked, I'll post code for that below the following code.

Code: [Select]
GOSUB menu

REPEAT
  WAIT 1
  GOSUB checkBoxes
UNTIL #CHARGHOST = YES

SUB checkBoxes
  menu get checkbox1
  IF #menures = #TRUE && %box1 = #TRUE
  {
    menu get checkbox2
    IF #menures = #TRUE && %box2 = #FALSE
    {
      menu set checkbox1 #FALSE
      set %box2 #TRUE
      set %box1 #FALSE
    }
  }
  menu get checkbox2
  IF #menures = #TRUE && %box2 = #TRUE
  {
    menu get checkbox1
    IF #menures = #TRUE && %box1 = #FALSE
    {
      menu set checkbox2 #FALSE
      set %box2 #FALSE
      set %box1 #TRUE
    }
  }
RETURN

SUB menu
menu Clear
menu Window Title EUOMenu1
menu Window Color BtnFace
menu Window Size 164 74
menu Font Transparent #true
menu Font Align Right
menu Font Name MS Sans Serif
menu Font Size 8
menu Font Style
menu Font Color WindowText
menu Font Align Left
menu Check checkbox1 32 20 97 17 #false Check Box 1
  menu set checkbox1 #TRUE
  SET %box1 #TRUE
  SET %box2 #FALSE
menu Check checkbox2 32 40 97 17 #false Check Box 2
menu Show 421 270
return


Changing this sub to the below code will make it turn checkbox2 OFF whenever checkbox1 is #TRUE.  Very simple.  Great for things that will interfere with each other if they are checked.  Kinda forces the user to select what you need them to. :)

Code: [Select]
SUB checkBoxes
  menu get checkbox1
  IF #menures = #TRUE
    menu set checkbox2 #FALSE
RETURN
« Last Edit: May 15, 2010, 05:08:08 PM by Scripty »

Offline AlphaTopic starter

  • Hero Member
  • *
  • Posts: 583
  • Activity:
    0%
  • Reputation Power: 10
  • Alpha barely matters.Alpha barely matters.
  • Respect: +44
  • Referrals: 0
    • View Profile
Re: Question / Help with Menu Check Command....
« Reply #4 on: May 15, 2010, 11:45:31 PM »
0
THX Script that was Exactly what I was looking for but I don't feel too bad now heh...

Heck when I asked in the Shout Box..

Quote
Alpha: Is there a command to uncheck a menu checkbox?
I got this Answer...

Quote
Cerveza: menu Check {name} {x} {y} {width} {height} {checked} {text} - CHECKED is either #true or #false

Which was all good because at that point I hadn't realized I could set #True / #False with the "Menu Check" commands...
But....  as I played with it I ended up with something amazing similar to what you posted.. Matter of fact if you replace that Mysterious
"Menu set checkbox1 #false"  with a similar "Menu Check" command it don't work for $HIT lol...  On a Side note.. I had already gone through the Docs reguarding Menu stuff  http://wiki.easyuo.com/index.php/Menu_Set and didn't think "menu Set  Sets the text of a control  "  had anything to do with what I was looking for.  Anyway thx again..  "Menu Set checkbox #false" etc was what I was missing...
Code: [Select]
GOSUB menu

REPEAT
  WAIT 1
  GOSUB checkBoxes
UNTIL #CHARGHOST = YES

SUB checkBoxes
  menu get checkbox1
  IF #menures = #TRUE && %box1 = #TRUE
  {
    menu get checkbox2
    IF #menures = #TRUE && %box2 = #FALSE
    {
      ;menu set checkbox1 #FALSE
      menu Check checkbox1 32 20 97 17 #false Check Box 1   ;--Using this is what I was trying & didn't work at all..
      set %box2 #TRUE
      set %box1 #FALSE
    }
  }
  menu get checkbox2
  IF #menures = #TRUE && %box2 = #TRUE
  {
    menu get checkbox1
    IF #menures = #TRUE && %box1 = #FALSE
    {
      ;menu set checkbox2 #FALSE
      menu Check checkbox2 32 40 97 17 #false Check Box 2  ;--Using this is what I was trying & didn't work at all..
      set %box2 #FALSE
      set %box1 #TRUE
    }
  }
RETURN

menu check Primary 5 5 85 20 #false Primary

SUB menu
menu Clear
menu Window Title EUOMenu1
menu Window Color BtnFace
menu Window Size 164 74
menu Font Transparent #true
menu Font Align Right
menu Font Name MS Sans Serif
menu Font Size 8
menu Font Style
menu Font Color WindowText
menu Font Align Left
menu Check checkbox1 32 20 97 17 #false Check Box 1
  menu set checkbox1 #TRUE
  SET %box1 #TRUE
  SET %box2 #FALSE
menu Check checkbox2 32 40 97 17 #false Check Box 2
menu Show 421 270
return

Changing this sub to the below code will make it turn checkbox2

Scrripty

  • Guest
Re: Question / Help with Menu Check Command....
« Reply #5 on: May 16, 2010, 09:14:16 AM »
0
Remember that you define your menu in a subroutine seperate from everything else, and all the menu items can be controlled from in your script with menu set commands.  But things like button colors need to be changed by deleting the old button and putting in a new button with a new color.  Like if you wanted a grey button to turn red when clicked.  I've got some really advanced button interaction subs I can post if you'd like.  Take a day or two to rip them out of the scripts they are in tho.  Just remind me in a day or two and I'll do it.  Also, don't forget TM's list handling subs which no one really uses but are GREAT for some serious scripts... :)  I love the list subs personally.  They are hosted here and SO easy to use if you try them out if you find a use.

Offline AlphaTopic starter

  • Hero Member
  • *
  • Posts: 583
  • Activity:
    0%
  • Reputation Power: 10
  • Alpha barely matters.Alpha barely matters.
  • Respect: +44
  • Referrals: 0
    • View Profile
Re: Question / Help with Menu Check Command....
« Reply #6 on: May 16, 2010, 10:00:31 AM »
0
Yea I was aware of TM's list handling subs, but haven't looked at them yet.  My Rule of Thumb is I try everything on my own & usually don't DL other's attempts until I start wondering how I could have made mine better.  I've got a few things using some arrays though & I'm sure TM did a better job so I'll take a peek.

Tags: