Author Topic: Sharing finditem data with other accounts  (Read 9437 times)

0 Members and 1 Guest are viewing this topic.

Offline GemviperTopic starter

  • Sr. Member
  • *
  • Posts: 481
  • Activity:
    0%
  • Reputation Power: 0
  • Gemviper hides in shadows.
  • Respect: +131
  • Referrals: 2
    • View Profile
Sharing finditem data with other accounts
« on: December 06, 2015, 04:36:17 PM »
0
Let's say I'm running a script that performs several FINDITEM requests and ignores many items that don't meet the criteria I set, and let's say that I have more than one account running the same script at the same time, is there a way for them to share information?

example: character 1 finds something and performs an ignoreitem on it, is there a way for character 2 to share that ignore and not waste time on it? I noticed that both accounts tried to interact with the same item at the same time and it crashed one of the clients, not good.

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: +602
  • Referrals: 2
    • View Profile
Re: Sharing finditem data with other accounts
« Reply #1 on: December 07, 2015, 07:13:21 AM »
0
Have you considered just using *persistent variables to store the data so that they are available to all running scripts?
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: +786
  • Referrals: 1
    • View Profile
Re: Sharing finditem data with other accounts
« Reply #2 on: December 07, 2015, 01:38:21 PM »
0
as 12x said persistent vars are probably the way to go. 
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: 13314
  • Activity:
    0%
  • 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: +3090
  • Referrals: 34
    • View Profile
    • ScriptUO
Re: Sharing finditem data with other accounts
« Reply #3 on: December 07, 2015, 01:40:03 PM »
0
If you can run multiple scripts in a single EUO instance, then you can easily use global namespaces. 
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline GemviperTopic starter

  • Sr. Member
  • *
  • Posts: 481
  • Activity:
    0%
  • Reputation Power: 0
  • Gemviper hides in shadows.
  • Respect: +131
  • Referrals: 2
    • View Profile
Re: Sharing finditem data with other accounts
« Reply #4 on: December 07, 2015, 10:48:03 PM »
0
Thanks, I'd never heard of globals until now  8)

re:ignoreitem
- performance considerations? If 2 scripts share and update the same ignore list at the same time should I expect some extra latency from the code? Anything noticeable requiring some extra wait time for example?

- is there any other consideration needed within the code to use globals on an ignore list? ie: will it affect any other functions of that script?

Just wondering what surprises lay in store for me while work on a global ignoreitem list. Thanks again.


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: +602
  • Referrals: 2
    • View Profile
Re: Sharing finditem data with other accounts
« Reply #5 on: December 08, 2015, 03:06:28 AM »
0
Thanks, I'd never heard of globals until now  8)

re:ignoreitem
- performance considerations? If 2 scripts share and update the same ignore list at the same time should I expect some extra latency from the code? Anything noticeable requiring some extra wait time for example?

- is there any other consideration needed within the code to use globals on an ignore list? ie: will it affect any other functions of that script?

Just wondering what surprises lay in store for me while work on a global ignoreitem list. Thanks again.
Not Global, Persistent. TM's point is if you're doing everything from one script you can use Global however if you want to share values between two scripts you need to use Persistent. Just keep in mind that excessive use of Persistent vars will fill up your registry.

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 GemviperTopic starter

  • Sr. Member
  • *
  • Posts: 481
  • Activity:
    0%
  • Reputation Power: 0
  • Gemviper hides in shadows.
  • Respect: +131
  • Referrals: 2
    • View Profile
Re: Sharing finditem data with other accounts
« Reply #6 on: December 08, 2015, 04:45:49 AM »
0
Same script, doing the same thing, being run by multiple characters. Right now each flows through the script independently, each creating their own ignore lists, but some of their actions are redundant since the other character has already done it.

example: idoc, 2 characters looting, no need for both to check every item. If character A finds a sword but its not legendary or special and he ignores it there's no need to character B to waste time on it. A shared ignore list would help where milliseconds count.

example two: resource collection(tree stump logs, dolphin rug SoS's etc). Finishing the job fast with two characters would be easier if the characters walked towards uncollected goods only, without checking things the other already has.

I'd have some use with my tailor/smith in sharing the work area too while making full suits (lrc, 70's etc). I have no clue how much is too much for the registry to handle. I've started my scripts slow and revised them to speed them up until I am happy and they feel solid.

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: +786
  • Referrals: 1
    • View Profile
Re: Sharing finditem data with other accounts
« Reply #7 on: December 08, 2015, 05:58:00 AM »
0
Thanks, I'd never heard of globals until now  8)

re:ignoreitem
- performance considerations? If 2 scripts share and update the same ignore list at the same time should I expect some extra latency from the code? Anything noticeable requiring some extra wait time for example?

- is there any other consideration needed within the code to use globals on an ignore list? ie: will it affect any other functions of that script?

Just wondering what surprises lay in store for me while work on a global ignoreitem list. Thanks again.
Not Global, Persistent. TM's point is if you're doing everything from one script you can use Global however if you want to share values between two scripts you need to use Persistent. Just keep in mind that excessive use of Persistent vars will fill up your registry.

X


Ahh Globals  forgot all about those...    TM did mean globals  NOT Persistent, they are different... and he also meant you can share vars between scripts as long as  ALL SCRIPTS are running in the SAME copy/instance of EasyUO.    IE run two scripts in one easyuo .. not 2 scripts in two separate easyuo sessions.

Here is an example of using globals.

Script 1  - run this first
Code: [Select]
namespace push
namespace global test
set !test hello
namespace pop
halt

Script 2  - Run 2nd
Code: [Select]
display ok  !test  - Global Namespace not set
namespace push
namespace global test
display ok  !test  -  Global namespace SET
namespace pop
display ok  !test  - Global Namespace not set
halt

Notice when you run the 2nd script...  !test = N/A   but once you set the Global Namespace  !test now = Hello (what was set in Script 1)  and if you close the global namespace !test = N/A once again ..

« Last Edit: December 08, 2015, 06:01:42 AM by Endless Night »
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 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: +602
  • Referrals: 2
    • View Profile
Re: Sharing finditem data with other accounts
« Reply #8 on: December 08, 2015, 06:09:12 AM »
0
Ah, I see, it didn't click because I thought that the namespace variables weren't exactly working as they should in EUO thus for something like this I would use a persistent to track the data so it's accessible to any script. I typically use namespace variables simply to keep my subs more modular, i.e. so they don't conflict with whatever is already in the script they are getting slipped into.

Am I correct in saying that a "Global" variable is any variable used in the Global Namespace which is the default Namespace for a given script? But then if you mark these as Namespace "!" that they are available to ANY script running in the same EUOX.exe instance?

I still think it would be easier, maybe preferable, to use an persistent in this particular case but I also don't have the same amount of experience as you guys.

X
« Last Edit: December 08, 2015, 06:17:07 AM by 12TimesOver »
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: +786
  • Referrals: 1
    • View Profile
Re: Sharing finditem data with other accounts
« Reply #9 on: December 08, 2015, 06:17:09 AM »
0
Ah, I see, it didn't click because I thought that the namespace variables weren't exactly working as they should in EUO thus for something like this I would use a persistent to track the data so it's accessible to any script.


As far as i know Namespace has been working fine ... I use it in a number of my scripts including the Buffbarscanner without issue
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 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: +602
  • Referrals: 2
    • View Profile
Re: Sharing finditem data with other accounts
« Reply #10 on: December 08, 2015, 06:22:16 AM »
0
Sorry, I should have elaborated - I know that Namespace works fine but I thought there were bugs in the way the Global Namespace was handled. I can't begin to tell you what got that in my head though. Maybe age.
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 TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13314
  • Activity:
    0%
  • 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: +3090
  • Referrals: 34
    • View Profile
    • ScriptUO
Re: Sharing finditem data with other accounts
« Reply #11 on: December 08, 2015, 06:57:37 AM »
0
Honestly I have been using global namespaces for years without issue.  Also they are probably a bit faster in this instance because you aren't having to invoke file I/O or another system infrastructure to record the information.  Your point about filling the registry is also a good one to keep in mind.

The only time I'd use system variables is if I need to persist data from run session to run session (i.e. saving script state or baseline) 

An interesting throught about being able to actually compile EUO now is that we can actually entertain the idea of FINALLY allowing for thoughtful file I/O.  Imagine that being able to save/read files without having to invoke the command prompt!  Wozers!

Anyhow Gem, here's a tutorial I wrote a long time ago that addresses namespaces (local and global) and also read closely what Endless said as he's spot on.

http://www.scriptuo.com/index.php?topic=108.0

Am I correct in saying that a "Global" variable is any variable used in the Global Namespace which is the default Namespace for a given script?

I think you're thinking about local and global namespaces, 12X.  For example:

Code: [Select]
namespace push ; save present namespace location
namespace local test1
set !var1 123
set !var2 456
namespace pop ; restore to previous namespace

namespace push ; save present namespace location
namespace local test2
set !var1 TREX
set !var2 BURITTOSAUR
namespace pop ; restore to previous namespace

namespace push ; save present namespace location
namespace global test3
set !var1 FINGERS
set !var2 TOES
namespace pop ; restore to previous namespace

Now I have 2 variables in 3 different locations (local:test1, local:test2 and global:test3) and all of which have different values.  Variables in local:test1 and local:test2 are only available for the current running script.  global:test3 is available to all script tabs running under one UO instance.  If you are running more than one copy of EUO, then each program will have its own global namespace area.  So if you need to share data in that paradigm, you'll need to use system variables (*vars).

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

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: +602
  • Referrals: 2
    • View Profile
Re: Sharing finditem data with other accounts
« Reply #12 on: December 08, 2015, 07:12:23 AM »
0
Ok, I see my mistake.

Thanks much for the explanation!

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 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: +786
  • Referrals: 1
    • View Profile
Re: Sharing finditem data with other accounts
« Reply #13 on: December 08, 2015, 07:48:52 AM »
0
Being as I forgot about globals and initially recommended persistent vars..  I may have pass my  ""Your a living breathing vortex of usefulness." hat over to TM for a SHORT spell   :P
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: 13314
  • Activity:
    0%
  • 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: +3090
  • Referrals: 34
    • View Profile
    • ScriptUO
Re: Sharing finditem data with other accounts
« Reply #14 on: December 08, 2015, 09:12:28 AM »
0
Being as I forgot about globals and initially recommended persistent vars..  I may have pass my  ""Your a living breathing vortex of usefulness." hat over to TM for a SHORT spell   :P

I honestly wouldn't mind using persistent variables except for the annoying issue where if you create it with EUO, there's no way to remove it even if you "clear" it.  If you look at the EasyUO section in your registry you'll be surprised how gunked up it is.

And thanks for the brief use of your Vortex moniker.  :)

I still think this picture really communicates how data is visible when using namespaces:

http://www.scriptuo.com/index.php?action=dlattach;topic=108.0;attach=6719
Please read the ScriptUO site RULES
Come play RIFT with me!

Tags: