ScriptUO

Ultima Online Fan Board => General UO Chat => Topic started by: Hitechs on March 12, 2017, 10:15:53 PM

Title: easyuo menu combo boxes
Post by: Hitechs on March 12, 2017, 10:15:53 PM
I just started working with menu combo boxes.

How do you code your menu combo box?

this code looks way too big for my liking.
what ever selected needs to set a var to #true, if none selected needs to set #false
(im watching the var #menures in the easyuo window when i make selections)

any suggestions on how i can make this less lines of code? or code it more leet

here some test code (its just a menu, you dont need client open to test)

Code: [Select]
;--------------------------------------------------------------------
   ;menu Combo ( {"Create"} {name} {x} {y} {width} ) | ( {"Add"} {name} {text} ) | ( {"SELECT"} {name} {index} )
    menu font BGColor black
    menu Font Color red
    menu Window Size 200 200
    menu font color red

   menu combo create familier 5 10 88
   menu combo add familier none
   menu combo add familier wisp
   menu combo add familier minion
   menu combo add familier death adder
   menu combo add familier vamp bat
   menu combo select familier 0
;------------------------------------------------------------------
   menu combo create form 5 50 88
   menu combo add form none
   menu combo add form Lich
   menu combo add form wraith
   menu combo add form human
   menu combo add form voyage
   menu combo add form reaper
   menu combo add form beast
   menu combo select form 0
   menu show
;------------------------------------------------------------

start:

  menu get form
  if #menures > 0
        gosub formComboBox
  menu get familier
  if #menures > 0
        gosub familierComboBox

goto start
;----------------------------------------

sub familierComboBox
if #menures = 1
    {
    menu combo select familier 0
    set !wisp #false
    set !minion #false
    set !deathAdder #false
    set !vampBat #false
    return
    }
if #menures = 2
   {
    set !wisp #true
    return
    }
if #menures = 3
   {
    set !minion #true
    return
    }
if #menures = 4
   {
    set !deathAdder #true
    return
    }
if #menures = 5
   {
    set !vampBar #true
    return
    }
return
;-----------------------------

sub formComboBox
if #menures = 1
    {
    menu combo select form 0
    set !lich #false
    set !wraith #false
    set !human #false
    set !voyage #false
    set !reaper #false
    set !beast #false
    return
    }
if #menures = 2
   {
    set !lich #true
    return
    }
if #menures = 3
   {
    set !wraith #true
    return
    }
if #menures = 4
   {
    set !human #true
    return
    }
if #menures = 5
    set !voyage #true
    return
    }
if #menures = 6
    {
    set !reaper #true
    return
    }
if #menures = 7
    {
    set !beast #true
    return
    }
return

Title: Re: easyuo menu combo boxes
Post by: The Ghost on March 13, 2017, 04:08:11 AM
To turn on and off my combo box, I use check box     You only use the sub combo box if you need them by using this  if #menures = #true .   This can remove a few reading code in the main loop, but you still need them in the sub to set the box.     Other them that it look go.

Title: Re: easyuo menu combo boxes
Post by: TrailMyx on March 13, 2017, 08:20:55 AM
With any EasyUO controls, you can't actually color code them individually.  So you need to "bracket" the control when you call it with the proper coloring commands:

Code: easyuo
  1.     menu font BGColor black
  2.     menu Font Color red
  3.     menu combo create first 5 10 88
  4.     menu combo add first entry_1
  5.     menu combo add first entry_2
  6.     menu font BGColor purple
  7.     menu Font Color white
  8.     menu combo create second 5 20 88
  9.     menu combo add second entry_1
  10.     menu combo add second entry_2
  11.