Official ScriptUO EasyUO Scripts > Script Debug

Saving settings?

<< < (3/3)

TrailMyx:

--- Quote from: baldielocks on June 05, 2021, 09:00:08 AM ---Thanks TM. What about overwriting the variable if I need to change it?

--- End quote ---

Just save it back and the registry entry will be changed.


--- Code: easyuo ---gosub TM_GetPersistantVariable TM_HEAL_BANDAGEset !bandies #RESULT....set !bandies !bandies + 50gosub TM_SetPersistantVariable TM_HEAL_BANDAGE !bandies  
Should be that simple...

baldielocks:

--- Code: ---set %initialize #true
set %primary #true
set %secondary #false
set %counterattack #true
set %LS #true
if %initialize = #false
{
gosub setpixel-primary
gosub setpixel-secondary
gosub setpixel-CA
gosub setpixel-LS
}
gosub TM_GetPersistantVariable #CURSORX #CURSORY 2
gosub TM_GetPersistantVariable #CURSORX #CURSORY 3
gosub TM_GetPersistantVariable #CURSORX #CURSORY 4
 gosub TM_GetPersistantVariable #CURSORX #CURSORY 5
goto mainloop
--- End code ---

Looks like that does it! Thank you. I'll be adding a menu for the initialize value.
 :D

TrailMyx:
That probably won't work unfortunately.  Try and close/reopen easyuo and you'll probably see.

TM_GetPersistantVariable only accepts 1 argument and TM_SetPersistantVariable accepts 2. Seeing your code you have:

--- Code: easyuo ---gosub TM_GetPersistantVariable #CURSORX #CURSORY 2 ; this won't work... 
assuming your #CHARID is XXYYZZ1 and #CURSORX is 15 as an example, TM_GetPersistantVariable will only return *15 and will do nothing with #CURSORY and 2 (the 3rd argument)  You'll probably need to do something like this:


--- Code: easyuo ---    event macro 35 0    display Move the mouse to the BOTTOM LEFT CORNER of the Primary Weapon Move button. You have 2 seconds    wait 2s    savePix #CURSORX #CURSORY 2    set %cursorx_2 #CURSORX     set %cursory_2 #CURSORY    gosub TM_SetPersistantVariable cursorx_2 #CURSORX    gosub TM_SetPersistantVariable cursory_2 #CURSORY    wait 5return 
Then when you load:


--- Code: easyuo ---  gosub TM_GetPersistantVariable cursorx_2   set %cursorx #RESULT    gosub TM_GetPersistantVariable cursory_2   set %cursory #RESULT  savePix %cursorx %cursory 2 
This will recall the last places where you clicked and save the appropriate x,y location in slot 2 of savePix.

baldielocks:
I think I followed your suggestions correctly, and modified the script. It will only do one special at a time now. Here is the whole thing I am working with. I use this as the core of most of my Melee scripts. Any suggestions TM?

--- Code: --- Display yesno Do you want to initalize /re-initialize this script?
 if #dispres = yes
set %initialized #false
if #dispres = no
set %initialized #true


set %primary #true
set %secondary #false
set %counterattack #true
set %LS #false
set %evade #scnt
set %confidence #scnt
if %initialized = #false
{
gosub setpixel-primary
gosub setpixel-secondary
gosub setpixel-CA
gosub setpixel-LS
}
  gosub TM_GetPersistantVariable cursorx_2
  set %cursorx_2 #RESULT
  gosub TM_GetPersistantVariable cursory_2
  set %cursory_2 #RESULT
  savePix %cursorx_2 %cursory_2 2
  ;
    gosub TM_GetPersistantVariable cursorx_3
  set %cursorx_3 #RESULT
  gosub TM_GetPersistantVariable cursory_3
  set %cursory_3 #RESULT
  savePix %cursorx_3 %cursory_3 3
  ;
    gosub TM_GetPersistantVariable cursorx_4
  set %cursorx_4 #RESULT
  gosub TM_GetPersistantVariable cursory_4
  set %cursory_4 #RESULT
  savePix %cursorx_4 %cursory_4 4
  ;
    gosub TM_GetPersistantVariable cursorx_5
  set %cursorx_5 #RESULT
  gosub TM_GetPersistantVariable cursory_5
  set %cursory_5 #RESULT
  savePix %cursorx_5 %cursory_5 5
goto mainloop
 ;----------------------------------
mainloop:
gosub non_interference
if %counterattack = #true
gosub ExecCA
if %primary = #true
gosub execprim
if %secondary = #true
gosub Execsec

if %LS = #true
gosub ExecLS
goto mainloop
:--------------------
sub setpixel-primary
    event macro 35 0
    display Move the mouse to the BOTTOM LEFT CORNER of the Primary Weapon Move button. You have 2 seconds
    wait 2s
    savePix #CURSORX #CURSORY 2
    set %cursorx_2 #CURSORX
    set %cursory_2 #CURSORY
    gosub TM_SetPersistantVariable cursorx_2 #CURSORX
    gosub TM_SetPersistantVariable cursory_2 #CURSORY
    wait 5
return
;------------------------
sub setpixel-secondary
    event macro 36 0
    display Move the mouse to the BOTTOM LEFT CORNER of the secondary Weapon Move button. You have 2 seconds
    wait 2s
    savePix #CURSORX #CURSORY 3
        set %cursorx_3 #CURSORX
    set %cursory_3 #CURSORY
    gosub TM_SetPersistantVariable cursorx_3 #CURSORX
    gosub TM_SetPersistantVariable cursory_3 #CURSORY
    wait 5
    event macro 36 0
return
 ;--------------------------------
sub setpixel-CA
    event macro 15 148
    display Move the mouse to the BOTTOM LEFT CORNER of the Counter Attack Weapon Move button. You have 2 seconds
    wait 2s
    savePix #CURSORX #CURSORY 4
        set %cursorx_4 #CURSORX
    set %cursory_4 #CURSORY
    gosub TM_SetPersistantVariable cursorx_4 #CURSORX
    gosub TM_SetPersistantVariable cursory_4 #CURSORY
    wait 5
return
;---------------------------------------
sub setpixel-LS
    event macro 15 149
    display Move the mouse to the BOTTOM LEFT CORNER of the Counter Attack Weapon Move button. You have 2 seconds
    wait 2s
    savePix #CURSORX #CURSORY 5
    set %cursorx_5 #CURSORX
    set %cursory_5 #CURSORY
    gosub TM_SetPersistantVariable cursorx_5 #CURSORX
    gosub TM_SetPersistantVariable cursory_5 #CURSORY
    wait 5
    event macro 15 149
return
;---------------------------------------

sub execPrim
if #mana > 24
{
    cmppix 2 f
       {
       event macro 35 0
       }
}
return
;------------------------------------
sub execSec
    cmppix 3 f
       {
       event macro 36 0
       }
return
;--------------------------------------
sub ExecCA
if #scnt > %evade
continue
if #scnt > %confidence
{
    cmppix 4 f
       {
       event macro 15 148
       wait 12
       }
return
}
return


;----------------------------------
;--------------------------------------
sub ExecLS
if #mana < 24 && #mana > 7
{
    cmppix 5 f
       {
       event macro 15 149
       }
}
return


;----------------------------------
sub non_interference
if #lspell = _104_113_116_145_150_201_202_203_204_205_206_207_208_209_210_716_717_719_720_723_724_725_726_727_728_729_730_731_732_734_736
{
if #lspell = 147
set %evade #scnt + 6
if #lspell = 146
set %confidence #scnt + 15
wait 2s
set #lspell 420
}
if #targcurs = 1
repeat
wait 1
until #targcurs = 0
return
;------------------------------------------------------------
sub TM_GetPersistantVariable
  set #RESULT %1 , _ , #CHARID
  set #RESULT * . #RESULT
return #RESULT
;------------------------------------------------------------
sub TM_SetPersistantVariable
  set #RESULT %1 , _ , #CHARID
  set * . #RESULT %2
return
;----------------------------------------
--- End code ---

Navigation

[0] Message Index

[*] Previous page

Go to full version