Author Topic: Variables  (Read 5434 times)

0 Members and 1 Guest are viewing this topic.

Offline MystreTopic starter

  • Newbie
  • *
  • Posts: 6
  • Activity:
    0%
  • Reputation Power: 0
  • Mystre has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Variables
« on: September 25, 2008, 07:33:44 PM »
0
So i am trying to create persistant variables based on the char name... im not that great a scripting but i know a lil. let me explain.

I have a script that keeps track of say wood chopped per session and total obviosly this is down with something like

%wood
and
*wood

now i am trying to run multiple accounts on the same pc, you can understand how my totals are going to get messed up unless i make multiple copies of the script with dif persistant variables. (the easy way)

I would rather find a way to create a variable based on a sys variable...

ex

set #charname . wood (clearly this doesnt work) lol


Ideas anyone?

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • 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: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Variables
« Reply #1 on: September 25, 2008, 07:49:06 PM »
0
What I do is use a couple really simple subroutines to save/recall information from the persistant variable pool:

Code: [Select]
;------------------------------------------------------------
sub TM_GetPersistantVariable
  set #RESULT %1 , _ , #CHARID
  set #RESULT * . #RESULT
return #RESULT
;------------------------------------------------------------
sub TM_SetPersistantVariable
  set #RESULT %1 , _ , #CHARID
  set * . #RESULT %2
return

So when I want to set something into persistant memory, I do:

Code: [Select]
    gosub TM_SetPersistantVariable TM_HEAL_BANDAGE !heal_bandage

and when I want to retrieve this information, I do:

Code: [Select]
  gosub TM_GetPersistantVariable TM_HEAL_BANDAGE
  set !heal_bandage #RESULT

Suppose your #CHARID is XXYYZZ1, with these functions the value contained in !heal_bandage is stored in *TM_HEAL_BANDAGE_XXYYZZ1.  So now this is character specific.

Hope this helps.

TM

Please read the ScriptUO site RULES
Come play RIFT with me!

Offline MystreTopic starter

  • Newbie
  • *
  • Posts: 6
  • Activity:
    0%
  • Reputation Power: 0
  • Mystre has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Variables
« Reply #2 on: September 28, 2008, 04:41:17 PM »
0
thats exactly what i was looking for :) now to implement it haha *sigh*

Offline 12TimesOver

  • Another Day, Another Vendetta
  • Global Moderator
  • *
  • *
  • Posts: 3694
  • Activity:
    0%
  • Reputation Power: 41
  • 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: +321
  • Referrals: 2
    • View Profile
Re: Variables
« Reply #3 on: September 29, 2008, 06:22:17 AM »
0
Ah, very nicely done! I was starting to think about this very topic as I work through revamping Miner For Dummies (adding the counters). Good food for thought. I'm still thinking that I'd like to save the variables out to the file system rather than the registry though so I really need to get a handle on your file system subs TM. Life has been damn busy as of late so the idea of actually spending time to advance my EUO coding education is laughable.

XII
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 Endless Night

  • Global Moderator
  • *
  • *
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +393
  • Referrals: 1
    • View Profile
Re: Variables
« Reply #4 on: September 29, 2008, 06:40:16 AM »
0
I always think saving to file is much more prefereable to the registery.. the registry is way overused in many EUO scripts for stuff that really dont need to be in thier.  just my own 2cents.
Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • 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: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Variables
« Reply #5 on: September 29, 2008, 08:11:59 AM »
0
I always think saving to file is much more prefereable to the registery.. the registry is way overused in many EUO scripts for stuff that really dont need to be in thier.  just my own 2cents.


I totally agree, EN!  I think it would be kinda funny to see how many registry entries people have for the EasyUO section.
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline talkmill

  • Jr. Member
  • **
  • Posts: 36
  • Activity:
    0%
  • Reputation Power: 0
  • talkmill has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Variables
« Reply #6 on: September 29, 2008, 10:34:48 AM »
0
I did a fast count, about 130 entries from that kind of variables in my registry. Only a month old install though :)

Offline 12TimesOver

  • Another Day, Another Vendetta
  • Global Moderator
  • *
  • *
  • Posts: 3694
  • Activity:
    0%
  • Reputation Power: 41
  • 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: +321
  • Referrals: 2
    • View Profile
Re: Variables
« Reply #7 on: September 29, 2008, 11:26:39 AM »
0
I always think saving to file is much more prefereable to the registery.. the registry is way overused in many EUO scripts for stuff that really dont need to be in thier.  just my own 2cents.


I totally agree, EN!  I think it would be kinda funny to see how many registry entries people have for the EasyUO section.

Exactly why I said what I said. Especially being a systems dude, I can't stand it when applications try to take ownership of a workstation or server as if it's the only application anyone will ever need. So yeah, this is next on the learning bloack for me...
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 talkmill

  • Jr. Member
  • **
  • Posts: 36
  • Activity:
    0%
  • Reputation Power: 0
  • talkmill has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Variables
« Reply #8 on: September 29, 2008, 11:55:05 AM »
0
Would have been cooler if everything was saved in some kind of easyuo database on disk so you could have the easy access (instead of the really clumsy way to go throgh cmd) but still have everything on file.

Offline Endless Night

  • Global Moderator
  • *
  • *
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +393
  • Referrals: 1
    • View Profile
Re: Variables
« Reply #9 on: September 30, 2008, 07:32:22 PM »
0
Well it would be really cool if easyuo did alot of things it dont.

Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Offline Crisis

  • Global Moderator
  • *
  • *
  • Posts: 3016
  • Activity:
    3.6%
  • Reputation Power: 41
  • Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.
  • Gender: Male
  • Scripting well enough to break things!
  • Respect: +206
  • Referrals: 2
    • View Profile
Re: Variables
« Reply #10 on: May 09, 2015, 06:08:24 AM »
0
Can someone explain this to me and how it is used? What variables are being saved?

For example, if I set a bag as a resource bag with a script and I use TM's sub here, will it keep that bag in memory every time I open the same script so I don't have to reset it?

Is there an advantage to this? I am seeing that at the time, too many scripts were saving things in the registry, is there a better way now that 7 years has gone by?

Offline The Ghost

  • Elite
  • *
  • *
  • Posts: 1917
  • Activity:
    0%
  • Reputation Power: 25
  • The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.
  • Respect: +245
  • Referrals: 0
    • View Profile
Re: Variables
« Reply #11 on: May 09, 2015, 06:41:08 AM »
0
Variable are nice since you only need to setup your bag once.  If you play different shard, u don't have to mod the script.  CEO use those lot and still work after 14 years :)

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • 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: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Variables
« Reply #12 on: May 09, 2015, 10:39:58 AM »
0
Can someone explain this to me and how it is used? What variables are being saved?

For example, if I set a bag as a resource bag with a script and I use TM's sub here, will it keep that bag in memory every time I open the same script so I don't have to reset it?

Is there an advantage to this? I am seeing that at the time, too many scripts were saving things in the registry, is there a better way now that 7 years has gone by?

Unfortunately EUO hasn't evolved at all with regard to file I/O.  I have hopes that the next version of EUO will finally open up the file I/O thing a little bit.  Until then, the registry or actually writing a file using "execute command echo" is the only way.  There are actually other ways.  I did a .NET program that communications through command registers in the registry to send blocks of data to an external program.  That worked well, but required an external program.
Please read the ScriptUO site RULES
Come play RIFT with me!

Tags: