ScriptUO

Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: The Ghost on January 15, 2015, 09:54:41 PM

Title: Menu Button not working right
Post by: The Ghost on January 15, 2015, 09:54:41 PM
I have make a quick menu, so I can disco target and kill target.    Right now if I disco target and try to kill it after,( hit the wips bottom the script select disco button.   If I hit the kill first if work but the second time I hit wips it will try to disco.     Can't figure out what I did work on the menu side of the house.  Can anyone shed some light plx.

The Event macro was to help me see when it exit the loop

Code: [Select]

set %monsterkill XI_EG_TG_ZF ;
set %discomonster XI_EG_TG_ZF
gosub menu1

set #menuButton N/A
Repeat
  If #MenuButton <> N/A
     {
     gosub #menuButton
     set #menuButton N/A
     }
until #false

Sub button1
menu Font Style b
menu Font Color Black
Menu Font Bgcolor White
menu font size 8
menu button button1 0 0 80 30 In.Used Disco
gosub disco
gosub reset
return

Sub button2 ;  Attach Wips
menu Font Style b
Menu Font Bgcolor White
menu Font Color red
menu font size 8
menu button button2 0 30 80 30 In.Used Wips
 repeat
finditem %monsterkill G_10
if #findkind = -1
{
  goSub button2menu
  return
}
if #findcnt > 0
{
  set #ltargetkind 1
  set #ltargetid #findid
  event macro 15 17   ; 36  mb
  target 3s
  event macro 22
  wait 2s
}
; until #CLICNT = 0
until #false

Sub button2menu
  menu Font Style b
  Menu Font Bgcolor black
  menu Font Color red
  menu font size 12
  menu button button1 0 30 80 30 Wips
  return


;  =====================Disco Component ==================================
; ========================================================================
sub disco
finditem %discomonster G_10
if #findkind = -1
   return
set %targeted #findid
set #ltargetid %targeted
set #ltargetkind 1
event macro 13 15 ; disco
target
event macro 22
wait 30
gosub TM_AdvJournalScan disco NONE play_jarring already_in_discord
if #result = #true
   {
   gosub TM_AdvJournalSync disco
   Event macro 3 0 Disco
   return
   }
if #result = #false
   {
   gosub TM_AdvJournalSync disco
   wait 6s
   Event macro 3 0 Fail
   return
   }
Event macro 3 0 exit. last
return

sub reset
menu Font Style b
menu Font Color Yellow
Menu Font Bgcolor green
menu font size 12
menu button button1 0 0 80 30 Disco
return

;=================================================================
; ========================  Menu ========================================
sub menu1
menu clear
wait 15
menu show 160 37
wait 10
menu show 0 770
menu window size 404 60
menu Font Style b
menu Font Color Yellow
Menu Font Bgcolor green
menu font size 12
menu button button1 0 0 80 30 Disco 
;
menu Font Style b
Menu Font Bgcolor black
menu Font Color red
menu font size 12
menu button button2 0 30 80 30 Wips
return
;=================================================================
Title: Re: Menu Button not working right
Post by: manwinc on January 15, 2015, 10:27:18 PM
You Overwrite button2 as button1

Sub button2menu
  menu Font Style b
  Menu Font Bgcolor black
  menu Font Color red
  menu font size 12
  menu button button1 0 30 80 30 Wips ; <-
  return

From Your Sub Menu1

menu button button2 0 30 80 30 Wips ; <-

Title: Re: Menu Button not working right
Post by: The Ghost on January 20, 2015, 03:34:01 PM
Thx  I felt ridiculous now. 4 days of work and u fix it  3o sec :(
Title: Re: Menu Button not working right
Post by: manwinc on January 20, 2015, 09:08:47 PM
Ohhhhh it took me A LOT MORE Than 30 seconds man.

I must of gone over your code for like 2 hours. Had to Run it a few times to see what you were talking about before I realized what was probably happening.
Title: Re: Menu Button not working right
Post by: The Ghost on January 21, 2015, 08:17:26 AM
I need to be more carefull with copy/paste.  This one bit me in the ass and hard,  Thx for the assist and the time.    Trying to make a Despise helper.     I was looping everthing and find out that while waiting for the new targer i wasn't attacking.  So seen to be faster and just hit button on second account.
Title: Re: Menu Button not working right
Post by: manwinc on January 21, 2015, 02:07:05 PM
What Would Suggest Doing for future reference is adding a status Bar to your scripts. In your scripts when you were Making all your Modifications to the Buttons, i'm 99% Sure that you were actually just Constantly Creating New buttons on your Menu Each time that were just stacked on top of each other, which will eventually lead to issues. You'll either need to Delete Them Before Rebuilding them or Change up the Whole Strategy.

Just do a

Menu Edit (Name) (X) (Y) (Length) (Initial Text)

Then, when you want to change what it says you do

Menu Set (Name) "Text"

You will probably have to use , #Spc , To put spaces in between words unless you want to write a Sub to do it for you.

 *Wrote one for you, but you can always write your own.

So, just put

Gosub Mwinc_SPC

And then Type like you normally would after that. And it will turn the sentence into #Result



Code: [Select]
Menu Window Size 250 100
Menu Show 0 0
Menu Edit Status 5 5 240 Status
Gosub Mwinc_SPC This is a Test
Menu Set Status #Result
Wait 40
Gosub Mwinc_SPC This is Not A test
Menu Set Status #Result
Halt

Sub Mwinc_SPC
Namespace Push
Namespace Local Mwinc_SPC
set !String %1
For !N 2 %0
{
set !String !String , #Spc , % . !N
}
set #Result !String
Namespace Pop
Return #Result




Title: Re: Menu Button not working right
Post by: ZigZagZebra on January 21, 2015, 08:28:00 PM
there goes manwinc, whoring himself out for script help  ;)
Title: Re: Menu Button not working right
Post by: The Ghost on January 22, 2015, 07:47:20 AM
Thx, More string, Now let see how I can utilize this little snippet.