Author Topic: Saving settings?  (Read 3460 times)

0 Members and 1 Guest are viewing this topic.

Offline lob91Topic starter

  • Jr. Member
  • **
  • Posts: 25
  • Activity:
    0%
  • Reputation Power: 1
  • lob91 has no influence.
  • Respect: +3
  • Referrals: 0
    • View Profile
Saving settings?
« on: April 04, 2010, 10:32:15 PM »
0
Hey.. been away from scripting for a while, anywho... looking to only be required to do the initial setup once and then be able to always start with those setting presaved (from the first and only setup)

can anyone point me in the right dirrection on what I might use? Thank you.

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13160
  • Activity:
    1.6%
  • Reputation Power: 153
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1343
  • Referrals: 32
    • View Profile
    • ScriptUO
Re: Saving settings?
« Reply #1 on: April 04, 2010, 10:47:22 PM »
0
I'm in the process of releasing my new filesystem.   With that you can store/recall variables very easily.  Also with an additional set of routines, you can browse other contents managed by the file system.  I'm calling this my next-generation file system.  NGFS for short.  Sorry Star Trek, no relation.

So perhaps you might give them a try.  I'll probably be releasing something usable in a week or two.

There are 1 attachment(s) in this post. You must register and post an acceptable introduction to download
tm_ngfs1.png
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline lob91Topic starter

  • Jr. Member
  • **
  • Posts: 25
  • Activity:
    0%
  • Reputation Power: 1
  • lob91 has no influence.
  • Respect: +3
  • Referrals: 0
    • View Profile
Re: Saving settings?
« Reply #2 on: April 04, 2010, 10:59:45 PM »
0
looks sweet! What I am looking for should be pretty simple. I just need it to save 25 locations on the screen and save it so I don't have to reset the locations everytime I run the script

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13160
  • Activity:
    1.6%
  • Reputation Power: 153
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1343
  • Referrals: 32
    • View Profile
    • ScriptUO
Re: Saving settings?
« Reply #3 on: April 04, 2010, 11:02:32 PM »
0
looks sweet! What I am looking for should be pretty simple. I just need it to save 25 locations on the screen and save it so I don't have to reset the locations everytime I run the script

The file system should be right up your alley then.  You just have to "register" each variable you want to be tracked by the file system, and it does the rest.  Very simple, and almost no work on your part other than the registration.
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline 12TimesOver

  • Another Day, Another Vendetta
  • Global Moderator
  • *
  • *
  • Posts: 3637
  • Activity:
    0%
  • Reputation Power: 40
  • 12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.
  • Gender: Male
  • Respect: +319
  • Referrals: 2
    • View Profile
Re: Saving settings?
« Reply #4 on: April 05, 2010, 02:41:47 AM »
0
Lob,

In the meantime there is really a couple of ways to do it. The most common is to simply use persistent variables for the information you want to save (* instead of % or !). Each of these will be stored as an entry in the registry which can end up getting pretty cluttered (as you can imagine) especially after years of running scripts without cleaning anything up. THis is why people come up with "File Systems" to begin with. There are a couple of these available including TM's File handling subs as well as the CEO File System at EUO (which stores all of the variables in a single Reg entry.

But you can easily move forward with just using persistents. Usually what I do is try to give them a name that will be easy to identify when browsing the registry. For example, say you have a lumberjack script and you want to save the "Bank" option I would call the var something like *lobLJBank -see what I mean?

There is no way to delete the reg entries with EUO after creating them so try to keep the Persistents only to the necessary ones!

X
When they come for me I'll be sitting at my desk
     with a gun in my hand wearing a bulletproof vest
My, my, my how the time does fly
     when you know you're gonna die by the end of the night

Offline Katu

  • Jr. Member
  • **
  • Posts: 43
  • Activity:
    0%
  • Reputation Power: 2
  • Katu has no influence.
  • Respect: +5
  • Referrals: 0
    • View Profile
Re: Saving settings?
« Reply #5 on: April 05, 2010, 09:07:50 AM »
0
There is no way to delete the reg entries with EUO after creating them so try to keep the Persistents only to the necessary ones!

There is a way to delete those. Download EasyUO 1.4 and from options->variables->Delete all persistent variables.

-Katu

Offline 12TimesOver

  • Another Day, Another Vendetta
  • Global Moderator
  • *
  • *
  • Posts: 3637
  • Activity:
    0%
  • Reputation Power: 40
  • 12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.
  • Gender: Male
  • Respect: +319
  • Referrals: 2
    • View Profile
Re: Saving settings?
« Reply #6 on: April 05, 2010, 09:44:01 AM »
0
There is no way to delete the reg entries with EUO after creating them so try to keep the Persistents only to the necessary ones!

There is a way to delete those. Download EasyUO 1.4 and from options->variables->Delete all persistent variables.

-Katu
Thanks for pointing that out Katu! Not exactly what I meant though so let me rephrase, there is no way to delete your own entries using EUO code. You can certainly go in and manually purge individual entries as well. My point was that I can use EUO to create reg entries but a script can't clean up after itself thus the registry can get messy.

X
When they come for me I'll be sitting at my desk
     with a gun in my hand wearing a bulletproof vest
My, my, my how the time does fly
     when you know you're gonna die by the end of the night

Offline baldielocks

  • Sr. Member
  • *
  • Posts: 298
  • Activity:
    0%
  • Reputation Power: 4
  • baldielocks has no influence.
  • Gender: Male
  • Respect: +11
  • Referrals: 5
    • View Profile
Re: Saving settings?
« Reply #7 on: June 05, 2021, 07:22:03 AM »
0
Wanted to show I actually TRY to do research before I ask newblet questions.

What about over-writing an existing *var ? I'm THINK there is a way, but stumbling on the method. (this is from C_2's LAME)
Code: [Select]
gosub setpixel-primary
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
[b]    savePix #CURSORX #CURSORY 2[/b]
    wait 5
return

If I wanted to save the CMPPIX as a persistent for a specific character, I would do
Code: [Select]
savePix #charid , savePix #CURSORX #CURSORY 2
Now that I have it saved, i can skip set up for that everytime, which is nice!
But if Location of the tile changes, how would I go about skipping setup until I need to re-do it? I have tried several variations of a true / false state on the var.

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13160
  • Activity:
    1.6%
  • Reputation Power: 153
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1343
  • Referrals: 32
    • View Profile
    • ScriptUO
Re: Saving settings?
« Reply #8 on: June 05, 2021, 08:47:05 AM »
0
SavePix doesn't save a value from run to run of EasyUO, but only that instance.  If you want your script to remember a value  between times when you run a script, you must poke it back into a file somewhere or create a persistent variable for it ( * variable).

To quickly make a way to save/recall items from the registry (where persistent variables are stashed), I made these 2 little subs:

Code: easyuo
  1. ;------------------------------------------------------------
  2. sub TM_GetPersistantVariable
  3.   set #RESULT %1 , _ , #CHARID
  4.   set #RESULT * . #RESULT
  5. return #RESULT
  6. ;------------------------------------------------------------
  7. sub TM_SetPersistantVariable
  8.   set #RESULT %1 , _ , #CHARID
  9.   set * . #RESULT %2
  10. return
  11.  

These subs use your own #CHARID as a reference pointer to help you locate the value after its been stored. 

A script like my bandage script, I first save the values like this:
Code: easyuo
  1.     gosub TM_SetPersistantVariable TM_HEAL_BANDAGE !heal_bandage
  2.     gosub TM_SetPersistantVariable TM_HEAL_CHIVALRY !heal_chivalry
  3.     gosub TM_SetPersistantVariable TM_HEAL_MAGERY !heal_magery
  4.     gosub TM_SetPersistantVariable TM_HEAL_NECROMANCY !heal_necromancy
  5. ...
  6.  

When I first start the script, I call the Get for each of these variables and assigned them as needed (display, variables, etc):

Code: easyuo
  1.   gosub TM_GetPersistantVariable TM_HEAL_BANDAGE
  2.   menu set EUOCheckBox1 #RESULT
  3.   gosub TM_GetPersistantVariable TM_HEAL_CHIVALRY
  4.   menu set EUOCheckBox3 #RESULT
  5.   gosub TM_GetPersistantVariable TM_HEAL_MAGERY
  6.   menu set EUOCheckBox2 #RESULT
  7.   gosub TM_GetPersistantVariable TM_HEAL_NECROMANCY
  8.   menu set EUOCheckBox4 #RESULT
  9. ...
  10.  

Note you don't address the actually *var directly but you rely on the Get and Set subs for that so they can create the variable string for you.

EX.  #CHARID = XXYYZZ1, Variable=MooseCount

Inside TM_SetPersistantVariable
Code: easyuo
  1.   set #RESULT %1 , _ , #CHARID ; #RESULT becomes "MooseCount_XXYYZZ1",  this is the variable name used for this value in the registry
  2.   set * . #RESULT %2 ; used indirect reference "." to address *MooseCount_XXYYZZ1 and assignes whatever is in %2
  3. return
  4.  
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline baldielocks

  • Sr. Member
  • *
  • Posts: 298
  • Activity:
    0%
  • Reputation Power: 4
  • baldielocks has no influence.
  • Gender: Male
  • Respect: +11
  • Referrals: 5
    • View Profile
Re: Saving settings?
« Reply #9 on: June 05, 2021, 09:00:08 AM »
0
Thanks TM. What about overwriting the variable if I need to change it?

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13160
  • Activity:
    1.6%
  • Reputation Power: 153
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1343
  • Referrals: 32
    • View Profile
    • ScriptUO
Re: Saving settings?
« Reply #10 on: June 05, 2021, 09:17:10 AM »
0
Thanks TM. What about overwriting the variable if I need to change it?

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

Code: easyuo
  1. gosub TM_GetPersistantVariable TM_HEAL_BANDAGE
  2. set !bandies #RESULT
  3. ....
  4. set !bandies !bandies + 50
  5. gosub TM_SetPersistantVariable TM_HEAL_BANDAGE !bandies
  6.  

Should be that simple...
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline baldielocks

  • Sr. Member
  • *
  • Posts: 298
  • Activity:
    0%
  • Reputation Power: 4
  • baldielocks has no influence.
  • Gender: Male
  • Respect: +11
  • Referrals: 5
    • View Profile
Re: Saving settings?
« Reply #11 on: June 05, 2021, 09:22:46 AM »
0
Code: [Select]
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

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

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13160
  • Activity:
    1.6%
  • Reputation Power: 153
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1343
  • Referrals: 32
    • View Profile
    • ScriptUO
Re: Saving settings?
« Reply #12 on: June 05, 2021, 09:38:11 AM »
0
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
  1. gosub TM_GetPersistantVariable #CURSORX #CURSORY 2 ; this won't work
  2. ...
  3.  

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
  1.     event macro 35 0
  2.     display Move the mouse to the BOTTOM LEFT CORNER of the Primary Weapon Move button. You have 2 seconds
  3.     wait 2s
  4.     savePix #CURSORX #CURSORY 2
  5.     set %cursorx_2 #CURSORX
  6.     set %cursory_2 #CURSORY
  7.     gosub TM_SetPersistantVariable cursorx_2 #CURSORX
  8.     gosub TM_SetPersistantVariable cursory_2 #CURSORY
  9.     wait 5
  10. return
  11.  

Then when you load:

Code: easyuo
  1.   gosub TM_GetPersistantVariable cursorx_2
  2.   set %cursorx #RESULT  
  3.   gosub TM_GetPersistantVariable cursory_2
  4.   set %cursory #RESULT
  5.   savePix %cursorx %cursory 2
  6.  

This will recall the last places where you clicked and save the appropriate x,y location in slot 2 of savePix.
« Last Edit: June 08, 2021, 10:54:51 AM by TrailMyx »
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline baldielocks

  • Sr. Member
  • *
  • Posts: 298
  • Activity:
    0%
  • Reputation Power: 4
  • baldielocks has no influence.
  • Gender: Male
  • Respect: +11
  • Referrals: 5
    • View Profile
Re: Saving settings?
« Reply #13 on: June 12, 2021, 08:39:45 PM »
0
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: [Select]
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
;----------------------------------------

There are 1 attachment(s) in this post. You must register and post an acceptable introduction to download
BL wep moves demo.txt

Tags: