Shard is currently offline.



Take the Tour | Site Map

It is currently Fri Mar 22, 2019 10:07 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Sat Dec 23, 2017 4:10 pm 
Offline
Apprentice Scripter
Apprentice Scripter

Joined: 07/23/2007 15:36
Posts: 24

Groups:
I want to use only one script for my every gatherer characters.I want to define every gatherers runebook ID for every character ID.

set %CharID #charid
if %CharID = GKOW
{
set %bookid ZPSZLMD
}
if %CharID = GQCD
{
set %bookid MVNLZMD
}
....
....
....
for 20 characters


I add this top of the code but its not working.

GKOW is my first gatherers ID and ZPSZLMD is my gatherers runebook ID.


Top
  Profile 
PostPosted: Sun Dec 24, 2017 10:27 am 
Offline
Administrator
Administrator
User avatar

Joined: 08/12/2003 07:28
Posts: 19008
Location: Switzerland

  1. set %bookid_GQCD MVNLZMD
  2. set %bookid_GKOW ZPSZLMD
  3. msg %bookid_ . #CharID $

No need for a lot of IFs if you can use a sort of array to handle it on the go...

_________________
EUO Member and postwhore since: 19th Dezember, 2002; Loosing on freeshard Alexandria since: 5th January, 2005
Searches cure for cancer since: 17th November, 2003 on GRID.org & Worldcommunitygrid.org
Made scripts for Project 'Programmers for Alexandria' worth 50$
Image
Quote "mmorning": Where would theses boards be if Orn didn't miss all the sarcasm. Man its great having him here :)
Quote "author-unknown": Good idea. I gotta start doing that too. You're a trendsetter Orn. :)
Quote "dreyfus": #true is always #true


Top
  ProfileShow poster's scripts in the public script library 
PostPosted: Fri Jan 05, 2018 11:24 pm 
Offline
Apprentice Scripter
Apprentice Scripter

Joined: 07/23/2007 15:36
Posts: 24

Groups:
set %bookid_GKOW ZPSZLMD

When i do that only it doesn't work, what am i missing ?


Top
  Profile 
PostPosted: Sun Jan 07, 2018 1:12 am 
Offline
Novice Scripter
Novice Scripter

Joined: 07/16/2004 22:25
Posts: 47

Groups:
set %bookid_GKOW ZPSZLMD =>
set %bookid GKOW_ZPSZLMD

underline in the wrong place


Top
  Profile 
PostPosted: Sun Jan 07, 2018 2:51 am 
Offline
Legendary Scripter
Legendary Scripter
User avatar

Joined: 07/10/2004 17:11
Posts: 2307

kojak wrote:
set %bookid_GKOW ZPSZLMD =>
set %bookid GKOW_ZPSZLMD

underline in the wrong place


Shhh. He had it just fine. You aren't understanding what he's trying to do. GKOW is the ID of a character I'm assuming, and ZPSZLMD is the ID of a runebook. He's trying to swap using ids. You're confusing the issue. ;)

_________________
Image


Top
  ProfileShow poster's scripts in the public script library 
PostPosted: Tue Jan 09, 2018 12:44 pm 
Offline
Administrator
Administrator
User avatar

Joined: 08/12/2003 07:28
Posts: 19008
Location: Switzerland

Artaxata wrote:
set %bookid_GKOW ZPSZLMD

When i do that only it doesn't work, what am i missing ?
Post your code please...
The part posted here looks OK, but probably you mix up , and . somewhere I suppose...

_________________
EUO Member and postwhore since: 19th Dezember, 2002; Loosing on freeshard Alexandria since: 5th January, 2005
Searches cure for cancer since: 17th November, 2003 on GRID.org & Worldcommunitygrid.org
Made scripts for Project 'Programmers for Alexandria' worth 50$
Image
Quote "mmorning": Where would theses boards be if Orn didn't miss all the sarcasm. Man its great having him here :)
Quote "author-unknown": Good idea. I gotta start doing that too. You're a trendsetter Orn. :)
Quote "dreyfus": #true is always #true


Top
  ProfileShow poster's scripts in the public script library 
PostPosted: Tue Jan 09, 2018 5:03 pm 
Offline
Legendary Scripter
Legendary Scripter
User avatar

Joined: 07/10/2004 17:11
Posts: 2307

Orn, this looks a lot like something I do in swapping scripts a lot. It seems as if he a: got access to a script he shouldn't have, or b: stumbled upon something I've never really seen anyone else try to do but me. Those exact 3 variables are ones that I use in a script I wrote to do this. It looks like he's trying to learn how it's done. ;) I'd like to see code before I continue to help also.

_________________
Image


Top
  ProfileShow poster's scripts in the public script library 
PostPosted: Sat Jan 13, 2018 1:58 pm 
Offline
Administrator
Administrator
User avatar

Joined: 08/12/2003 07:28
Posts: 19008
Location: Switzerland

well... %bookid and %charid arent THIS unique... ;)

But yeah: Post the entire script and we will see if we can and want to help.

_________________
EUO Member and postwhore since: 19th Dezember, 2002; Loosing on freeshard Alexandria since: 5th January, 2005
Searches cure for cancer since: 17th November, 2003 on GRID.org & Worldcommunitygrid.org
Made scripts for Project 'Programmers for Alexandria' worth 50$
Image
Quote "mmorning": Where would theses boards be if Orn didn't miss all the sarcasm. Man its great having him here :)
Quote "author-unknown": Good idea. I gotta start doing that too. You're a trendsetter Orn. :)
Quote "dreyfus": #true is always #true


Top
  ProfileShow poster's scripts in the public script library 
PostPosted: Sat Oct 13, 2018 3:16 am 
Offline
Script Scribe
Script Scribe

Joined: 05/07/2012 14:53
Posts: 102

Groups:
I"m bumping this back to the top to see if I can get some input. I have a fairly simple script that I use for multiple characters at the same time. Because of my limited knowledge I have to open several instances of the same script and make changes for each character. I can't find a script to look at or any examples of how to use a single script for multiple characters and would love to be pointed in the right direction. For the record I'm not trying to make an annoying multi box situation, I just want to improve and this is one area where I'm at a total loss.


Top
  Profile 
PostPosted: Sat Oct 13, 2018 12:41 pm 
Offline
Administrator
Administrator
User avatar

Joined: 08/12/2003 07:28
Posts: 19008
Location: Switzerland

  1. Set *bookID_for_charID_ . #CharID %bookid


Lets say your #CharID of the first character is AAAAAA
Lets say the bookID of the A-Character is 111111

Lets say your #CharID of the second character is BBBBBB
Lets say the bookID of the B-Character is 222222

Lets say your #CharID of the third character is CCCCCC
Lets say the bookID of the C-Character is 333333


If you let this same code on the first line run on all 3 characters, it will create 3 different Persistent Variables:
  1. *bookID_for_charID_AAAAAA 111111
  2. *bookID_for_charID_BBBBBB 222222
  3. *bookID_for_charID_CCCCCC 333333


Later on, if you need to get back your BookID for THIS specific char, you just go like
  1. set %bookID *bookID_for_charID_ . #CharID
and it will take the corresponding variable and put its content into %books.

_________________
EUO Member and postwhore since: 19th Dezember, 2002; Loosing on freeshard Alexandria since: 5th January, 2005
Searches cure for cancer since: 17th November, 2003 on GRID.org & Worldcommunitygrid.org
Made scripts for Project 'Programmers for Alexandria' worth 50$
Image
Quote "mmorning": Where would theses boards be if Orn didn't miss all the sarcasm. Man its great having him here :)
Quote "author-unknown": Good idea. I gotta start doing that too. You're a trendsetter Orn. :)
Quote "dreyfus": #true is always #true


Top
  ProfileShow poster's scripts in the public script library 
PostPosted: Sat Oct 13, 2018 4:39 pm 
Offline
Adept Scripter
Adept Scripter

Joined: 04/14/2007 16:18
Posts: 148

Groups:
The other way to do generic runebooks for characters is to retrieve the runebook and match the name by #property (event property). This allows you to name a runebook as "bank" and each character has their own - then the script will seek out the book named 'bank' and use that one to go to banks. :)

Then name one as some other thing... like a resource (ore or mine or forest or mageshop) and have the script pull up the named runebook to satisfy which runebook you want.

The outline for the code becomes something like:
  1. find _RUNEBOOKTYPE_ C_ , #backpackid
  2.  {
  3.  if BANK in #property
  4.   set %bankbookid #findid
  5.  if MINE in #property
  6.   set %minebookid #findid
  7.  if TREE in #property
  8.   set %treebookid #findid
  9.  }
  10.  

Gaderian


Top
  ProfileShow poster's scripts in the public script library 
PostPosted: Sun Oct 14, 2018 6:31 am 
Offline
Script Scribe
Script Scribe

Joined: 05/07/2012 14:53
Posts: 102

Groups:
I can't tell if you 2 are replying to me or the OP through my bump. Can you tell me how to take 1 script and allow it to run for more than one character ID ? For instance, let's say I simply want to have a character with the Tailoring skill make spools of thread, and lets say I have 5 looms. Instead of having 1 character use 5 looms, which would be easy enough, how do I make 5 characters use 5 looms, with 1 script ?


Top
  Profile 
PostPosted: Sun Oct 14, 2018 7:14 am 
Offline
Administrator
Administrator
User avatar

Joined: 08/12/2003 07:28
Posts: 19008
Location: Switzerland

you cant as a script has to be tied to a UO-instance and therefore character.

_________________
EUO Member and postwhore since: 19th Dezember, 2002; Loosing on freeshard Alexandria since: 5th January, 2005
Searches cure for cancer since: 17th November, 2003 on GRID.org & Worldcommunitygrid.org
Made scripts for Project 'Programmers for Alexandria' worth 50$
Image
Quote "mmorning": Where would theses boards be if Orn didn't miss all the sarcasm. Man its great having him here :)
Quote "author-unknown": Good idea. I gotta start doing that too. You're a trendsetter Orn. :)
Quote "dreyfus": #true is always #true


Top
  ProfileShow poster's scripts in the public script library 
PostPosted: Sun Oct 14, 2018 8:16 am 
Offline
Script Scribe
Script Scribe

Joined: 05/07/2012 14:53
Posts: 102

Groups:
Ahh ok...hrm. Thank you


Top
  Profile 
PostPosted: Sun Oct 14, 2018 8:45 am 
Offline
Adept Scripter
Adept Scripter

Joined: 04/14/2007 16:18
Posts: 148

Groups:
Poopa,
Since you didn't initially mention any object to use for different characters, it looks like both Orn and I assumed you were looking for what the OP was asking about: runebooks. Anything that is in your character's backpack is easy to code for differently and both my suggestion and Orn's will work.

However, you will not have a loom in your backpack - so that tosses my example out.

You are asking about an object that is able to be located and used by multiple accounts at the same time. So in the case of a loom or other house add on (or this may apply to some items in a secure container. I have never tried items that stack - to pull a quantity shared from multiple accounts other than part of the example I will explain. I would imagine there may be an issue if one character takes the last of a stack at the same time as another account's character is trying to pull from that stack. I have done that kind of sharing for making cloth and for inscription, where I wanted lots of items produced and it was quicker to run on multiple accounts. It would probably be appropriate to be sensitive to have only 1 pull at a time, or code to detect if the final quantity as been taken from you.

So I did this with looms and spinning wheels. Basically 1 character can use 2 looms or 3 spinning wheels at a time. I made a set of looms and spinning wheels close to my secure container and had 2 accounts running. I targetted the looms in the other part of my script and simply alternated between those. Since I had 4 looms and 2 characters, I didn't need anything dealing with sharing the loom. The spinning wheels, however, have a delay that is significantly longer than the time it takes to target it with wool (or other resource). This makes it a useful item to cycle through several with more than one account.

There are 2 solutions I can think of where you can share the house add ons:
  1. Orn's suggestion where you hard code the id of a specific loom to the character in the script, assigned sensitive to #charid
  2. implement an array of the house add ons to cycle through using timers

I used the spinning wheels more than the looms in my personal solution and I will share the portion of the code that dealt with it here, with the warning that it was not something I was proud enough to publicly share. That means it had bugs and wasn't generic enough to apply to a general release. My solution is from many years ago and so what I am sharing here is not as extensively tested, but it is a cleaner solution.

Initially this used persistent variables, now it shows how to do the same logic with namespace variables.

  1. if %woolUseWait < ( #scnt2 - 15 ) ; this is the character's personal action wait time
  2.  set %woolUseWait 0
  3.  
  4. if !wool 1
  5.  set !wool 0 ; this means a shared resource is not being used, it is reset to 0 here because
  6.                  ; the script would finish and leave it set to 1, so the next time it would never start.
  7.                  ; Hardcoded here will spoil the first time a new account is run starting this script there (a hack for sure)
  8. wait 20
  9. set %backpack #contid
  10. wait 10
  11. finditem JFG_XEG_MHR G_8 ; look for spinning wheel
  12.  {
  13.  display ok there is no wheel near here.
  14.  }
  15. set %wheel_count #findcnt
  16. for #findindex 1 %wheel_count
  17.  {
  18.  set %wheelID . #findindex #findid ; produces an array %wheelID1, %wheelID2, ... %wheelID [last one numbered %wheel_count]
  19.  set !wheelIDwait . #findid #scnt2 ; creates a timer of when the wheel was used
  20.  }
  21. set %wheelID %wheelID1
  22.  
  23. wool:
  24. finditem OFF_NFF_QEK c_ , %backpack ;look for wool or cotton
  25.  {
  26.  set %JournalLine #jindex ; reference current journal line
  27.  set %wheel_timer #false
  28.  while %wheel_timer = #false
  29.   {
  30.   for %wheel_index 1 %wheel_count
  31.    {
  32.    set %current_wheel_id %wheelID . %wheel_index
  33.    if !wheelIDwait . %current_wheel_id < #scnt2
  34.     {
  35.     set %wheel_timer #true ; break out of while loop
  36.     set %current_wheel_number %wheel_index
  37.     }
  38.    }
  39.   }
  40.  while !wool <> 0 ; this waits until the other scripts have completed their actions
  41.   {
  42.   wait 1
  43.   }
  44.  set !wool 1
  45.  while %woolUseWait < #scnt2
  46.   wait 1
  47.  set #ltargetid %wheelID . %current_wheel_number
  48.  set !wheelIDwait . #ltargetid #scnt2 + !woolWheelWaitDelay
  49.  set %woolUseWait %woolUseWait + !woolWheelWaitDelay
  50.  set !wool 0
  51.  
  52. ; scanj_1: ; Pause till the yarn comes back from the spinning wheel into backpack
  53. ; while #jindex > %JournalLine ; check for new messages in journal
  54. ;  {
  55. ;  set %JournalLine %JournalLine + 1 ; advance journal line
  56. ;  scanjournal %JournalLine
  57. ;  if you_put_the notin #journal
  58. ;   {
  59. ;   wait 2
  60. ;   }
  61. ;  }
  62.  
  63.  finditem OFF_NFF_QEK c_ , #backpackid ;look for wool or cotton
  64.  }
  65.  

I left commented out the journal scan. There was a time when spools of yarn didn't stack when returning from the spinning wheel. You would end up with lots of individual items in your pack, so I had included a drag/drop routine on my backpack to stack the items and keep the backpack content count lower. I removed the gosub to the drag/drop/stack routine which followed the commented out section and the finditem several years ago, but maybe on a free shard (you didn't specify) it could be useful.

The variable !woolWheelWaitDelay is globally accessible because I made a small routine to adjust the timer of the various scripts without stopping and restarting the scripts. That routine could run external to this script and be used to raise/lower the timer.

I am sure the code could be streamlined, it was a tool to serve a purpose. It started as Victor's Wool and Cloth bot on the PSL which I had updated years ago to handle some new house add ons and cleaned up the code for journal messaging.

You mentioned looms, but I just setup or 2 per character to use and alternated. This demonstrates how to use the house add on in a shared setting, so you can get an idea of how it could function and use your own 'slow' house add on. Things like forges and anvils don't matter, but there may be tools other than the tailoring ones which have a delay built into it for uses.

Gaderian


Top
  ProfileShow poster's scripts in the public script library 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Hosted by CalWeb Internet Services, Inc.