Shard is currently offline.



Take the Tour | Site Map

It is currently Mon Jun 18, 2018 8:43 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: Tue Jun 05, 2018 6:47 am 
Offline
Adept Scripter
Adept Scripter

Joined: 09/13/2010 10:59
Posts: 163

Groups:
does EOU support arrays and or tables
i am working on my bod turn in script and would like to have an array of rewards I can access like

reward[1] = Reward One
reward[2] = reward TWo
reward[3] = third reward

this table is so user can reference a reward number by name
but in a format that EUO recognizes

then i would have a point value list ie

value[10] = 1
value[25] = 3
value[50] = 5

set %pointvalue 25
where the 10,25,50 is the bod reward value and the 1,3,5 is the reward to select

so when the script is run and the bod is turned in, if the value of the reward is 25 points it would look up value[%pointvalue] and know to select reward number 3

can anyone tell me how to go about this


Top
  Profile 
PostPosted: Tue Jun 05, 2018 12:29 pm 
Offline
Administrator
Administrator
User avatar

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

Sort of...
  1. for %i 1 50
  2. {
  3. set %data %i * %i
  4. set %Array . %i %data
  5. }


this will create a "table" named Array with 50 indexes holding the cube of its number.
See also http://wiki.easyuo.com/index.php?title=Operators for the dot operator

In a nutshell
Your
  1. value[10] = 1
becomes
  1. set %value . 10 1

Then the value of 1 can be retrieved by means of
  1. set %reward %value . %bodamount
given %bodamount holds 10 in our little example here

_________________
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 Jun 05, 2018 2:31 pm 
Offline
Adept Scripter
Adept Scripter

Joined: 09/13/2010 10:59
Posts: 163

Groups:
so here is my example and it is working like i expected, i really like that you can use a varible for the array name
will make it so much easier since there will be an array/table for each bod type
Code:
  1. set %value . 10 1
  2. set %value . 25 3
  3. set %value . 50 5
  4. set %value . 60 5
  5. set %value . 75 5
  6. set %value . 100 7
  7. set %value . 110 7
  8. set %value . 125 7
  9. set %value . 150 8
  10.  
  11. set %points 125  ; this is retrieved from the reward screen when turning in a bod
  12.  
  13. set %reward %value . %points ; %reward is 7 in this case, so the next step selects the 7th reward


Top
  Profile 
PostPosted: Tue Jun 05, 2018 3:02 pm 
Offline
Legendary Scripter
Legendary Scripter
User avatar

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

The rewards are different for different bod types though. So you'd have to do it for every value of every bod type. That's a lot of work. You could do it by % . %bodType , %value also. Then you have say, %iron125, or %bronze250, or %leather125... And have a reward for each, with one table, that has the values for all the different bod types. :) Then you could do a quick search through the bod types that you're doing, say tinker, and just add the points to it that the bod is worth, say 150, and then do a loop through the points, like, for % . %tinker . %points and if the points are greater or equal to whatever that variable is, keep going until it equals false, and set your reward to the last reward that evaluated #true. heh I hope that makes sense.

_________________
Image


Top
  ProfileShow poster's scripts in the public script library 
PostPosted: Wed Jun 06, 2018 12:52 am 
Offline
Administrator
Administrator
User avatar

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

Yes: You can use a variable to hold your Arrayname.
Like
  1. Set % . %BODtype , %itemcount %reward
to get the same as with
  1. Set %iron20 2
  2. Set %valorite20 8
  3. Set %barbed100 6
and so on.

Edit: Ah... Scripty alread gave the same answer :)

_________________
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: Wed Jun 06, 2018 3:17 am 
Offline
Adept Scripter
Adept Scripter

Joined: 09/13/2010 10:59
Posts: 163

Groups:
Code:
  1. set %value . 10 . 1 1  ; blacksmith reward
  2. set %value . 10 . 2 1  ; tailor reward
  3. set %value . 10 . 3 1    ;tinker reward
  4.  
  5. ; whould really like to see if it could be entered on one line like
  6. ;  set %value . 10 .  {1,3,4,22,5,8,6,10} ; to enter all 8 bod type reward selections for that point value
  7. set %value . 500 . 1 15
  8. set %value . 500 . 2 15
  9. set %value . 500 . 3 18
  10. set %value . 500 . 4 20
  11.  
  12.  
  13. set %points 500
  14. set %bodtype 2
  15.  
  16.  
  17. set %reward %value . 500 . 2   ;here %reward = 15
  18. set %reward2 %value . %points . %bodtype  ; but here %reward2 = %valueN/A


so why does %reward work but %reward1 does not


Top
  Profile 
PostPosted: Wed Jun 06, 2018 6:31 am 
Offline
Adept Scripter
Adept Scripter

Joined: 09/13/2010 10:59
Posts: 163

Groups:
SO, here is what i come up with, this is 2 of the 8 tables as of right now i have to provide a list of rewards with the reward number so that a user would know what it was, but eventually i would like to create a menu system that will allow the user to select there rewards for each point value

Code:
  1. set %value . 10 . tailor 1  ; tailor reward
  2. set %value . 25 . tailor 3  ; tailor reward
  3. set %value . 50 . tailor 5  ; tailor reward
  4. set %value . 60 . tailor 5  ; tailor reward
  5. set %value . 75 . tailor 5  ; tailor reward
  6. set %value . 100 . tailor 7  ; tailor reward
  7. set %value . 110 . tailor 7  ; tailor reward
  8. set %value . 125 . tailor 7  ; tailor reward
  9. set %value . 150 . tailor 7  ; tailor reward
  10. set %value . 160 . tailor 7  ; tailor reward
  11. set %value . 175 . tailor 7  ; tailor reward
  12. set %value . 200 . tailor 10  ; tailor reward
  13. set %value . 210 . tailor 11  ; tailor reward
  14. set %value . 225 . tailor 10  ; tailor reward
  15. set %value . 250 . tailor 11  ; tailor reward
  16. set %value . 260 . tailor 10  ; tailor reward
  17. set %value . 275 . tailor 11  ; tailor reward
  18. set %value . 300 . tailor 13  ; tailor reward
  19. set %value . 310 . tailor 14  ; tailor reward
  20. set %value . 325 . tailor 13  ; tailor reward
  21. set %value . 350 . tailor 15  ; tailor reward
  22. set %value . 360 . tailor 16  ; tailor reward
  23. set %value . 375 . tailor 15  ; tailor reward
  24. set %value . 400 . tailor 17  ; tailor reward
  25. set %value . 410 . tailor 17  ; tailor reward
  26. set %value . 425 . tailor 17  ; tailor reward
  27. set %value . 450 . tailor 17  ; tailor reward
  28. set %value . 460 . tailor 17  ; tailor reward
  29. set %value . 475 . tailor 17  ; tailor reward
  30. set %value . 500 . tailor 20  ; tailor reward
  31. set %value . 510 . tailor 20 ; tailor reward
  32. set %value . 525 . tailor 20 ; tailor reward
  33. set %value . 550 . tailor 20 ; tailor reward
  34. set %value . 560 . tailor 21  ; tailor reward
  35. set %value . 575 . tailor 21  ; tailor reward
  36. set %value . 600 . tailor 23  ; tailor reward
  37. set %value . 610 . tailor 23  ; tailor reward
  38. set %value . 625 . tailor 23  ; tailor reward
  39. set %value . 650 . tailor 24  ; tailor reward
  40. set %value . 660 . tailor 24 ; tailor reward
  41. set %value . 675 . tailor 24 ; tailor reward
  42. set %value . 700 . tailor 25 ; tailor reward
  43. set %value . 710 . tailor 25 ; tailor reward
  44. set %value . 725 . tailor 25 ; tailor reward
  45. set %value . 750 . tailor 25 ; tailor reward
  46. set %value . 760 . tailor 25 ; tailor reward
  47. set %value . 775 . tailor 25 ; tailor reward
  48. set %value . 800 . tailor 25 ; tailor reward
  49.  
  50.  
  51. blacksmith
  52. set %value . 10 . BS 1  ; Blacksmith reward
  53. set %value . 25 . BS 2  ; Blacksmith reward
  54. set %value . 50 . BS 2  ; Blacksmith reward
  55. set %value . 210 . BS 8 ; Blacksmith reward
  56. set %value . 225 . BS 9  ; Blacksmith reward
  57. set %value . 250 . BS 8  ; Blacksmith reward
  58. set %value . 260 . BS 9  ; Blacksmith reward
  59. set %value . 275 . BS 8  ; Blacksmith reward
  60. set %value . 300 . BS 9  ; Blacksmith reward
  61. set %value . 310 . BS 8  ; Blacksmith reward
  62. set %value . 325 . BS 9  ; Blacksmith reward
  63. set %value . 350 . BS 10  ; Blacksmith reward
  64. set %value . 360 . BS 10 ; Blacksmith reward
  65. set %value . 375 . BS 10; Blacksmith reward
  66. set %value . 400 . BS 11  ; Blacksmith reward
  67. set %value . 410 . BS 11  ; Blacksmith reward
  68. set %value . 425 . BS 11  ; Blacksmith reward
  69. set %value . 450 . BS 13  ; Blacksmith reward
  70. set %value . 460 . BS 13  ; Blacksmith reward
  71. set %value . 475 . BS 13  ; Blacksmith reward
  72. set %value . 500 . BS 13 ; Blacksmith reward
  73. set %value . 510 . BS 13  ; Blacksmith reward
  74. set %value . 525 . BS 13  ; Blacksmith reward
  75. set %value . 550 . BS 18 ; Blacksmith reward
  76. set %value . 560 . BS 18  ; Blacksmith reward
  77. set %value . 575 . BS 13 ; Blacksmith reward
  78. set %value . 600 . BS 13  ; Blacksmith reward
  79. set %value . 610 . BS 13  ; Blacksmith reward
  80. set %value . 625 . BS 13  ; Blacksmith reward
  81. set %value . 650 . BS 23  ; Blacksmith reward
  82. set %value . 660 . BS 23 ; Blacksmith reward
  83. set %value . 675 . BS 13 ; Blacksmith reward
  84. set %value . 700 . BS 25  ; Blacksmith reward
  85. set %value . 710 . BS 26 ; Blacksmith reward
  86. set %value . 725 . BS 26  ; Blacksmith reward
  87. set %value . 750 . BS 28  ; Blacksmith reward
  88. set %value . 760 . BS 28 ; Blacksmith reward
  89. set %value . 775 . BS 28  ; Blacksmith reward
  90. set %value . 800 . BS 13 ; Blacksmith reward
  91. set %value . 810 . BS 13  ; Blacksmith reward
  92. set %value . 825 . BS 13 ; Blacksmith reward
  93. set %value . 850 . BS 30 ; Blacksmith reward
  94. set %value . 860 . BS 30 ; Blacksmith reward
  95. set %value . 875 . BS 30 ; Blacksmith reward
  96. set %value . 900 . BS 32 ; Blacksmith reward
  97. set %value . 910 . BS 32 ; Blacksmith reward
  98. set %value . 925 . BS 32 ; Blacksmith reward
  99. set %value . 950 . BS 34  ; Blacksmith reward
  100. set %value . 960 . BS 34 ; Blacksmith reward
  101. set %value . 975 . BS 34 ; Blacksmith reward
  102. set %value . 1000 . BS 35  ; Blacksmith reward
  103. set %value . 1010 . BS 35 ; Blacksmith reward
  104. set %value . 1025 . BS 35 ; Blacksmith reward
  105. set %value . 1050 . BS 36 ; Blacksmith reward
  106. set %value . 1060 . BS 37 ; Blacksmith reward
  107. set %value . 1075 . BS 36 ; Blacksmith reward
  108. set %value . 1100 . BS 38 ; Blacksmith reward
  109. set %value . 1110 . BS 38 ; Blacksmith reward
  110. set %value . 1125 . BS 38 ; Blacksmith reward
  111. set %value . 1150 . BS 39 ; Blacksmith reward
  112. set %value . 1160 . BS 40 ; Blacksmith reward
  113. set %value . 1175 . BS 39 ; Blacksmith reward
  114. set %value . 1200 . BS 41 ; Blacksmith reward
  115.  
  116.  
  117.  
  118.  
  119. set %points 750
  120. set %bodtype tailor
  121. set %pb %points , %bodtype ; had to create this var since the 3rd line below would not work
  122.  
  123. set %reward %value . %pb                                 ;  here %reward = 25
  124. ;set %reward2 %value . 750 . %bodtype              ;here %reward = 25
  125. set %reward2 %value . %points . %bodtype ; 3rd line here %reward2 = %valueN/A


Top
  Profile 
PostPosted: Wed Jun 06, 2018 7:25 am 
Offline
Legendary Scripter
Legendary Scripter
User avatar

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

Why even type out the "value" portion? Why not just use % . %num . %type = %amount? That's 5 less characters you need to type per line. That equals %tailor200 7 or whatever you want. It just allows you to use variables to set those quantities. Or check them if you'd like... No need to use %value. Just use % . ................ % #dot %rewardAmount #dot %bodyType %value...

_________________
Image


Top
  ProfileShow poster's scripts in the public script library 
PostPosted: Wed Jun 06, 2018 7:43 am 
Offline
Adept Scripter
Adept Scripter

Joined: 09/13/2010 10:59
Posts: 163

Groups:
Scripty wrote:
Why even type out the "value" portion? Why not just use % . %num . %type = %amount? That's 5 less characters you need to type per line. That equals %tailor200 7 or whatever you want. It just allows you to use variables to set those quantities. Or check them if you'd like... No need to use %value. Just use % . ................ % #dot %rewardAmount #dot %bodyType %value...



ok ill try that, even though i am not typing those characters, copy paste works wanders lol,

i subset and thanks for that tip it works

Code:
  1. set % . 10 . tailor 1  ; tailor reward
  2. set % . 25 . tailor 3  ; tailor reward
  3. set % . 50 . tailor 5  ; tailor reward
  4. set % . 60 . tailor 5  ; tailor reward
  5. set % . 75 . tailor 5  ; tailor reward
  6. set % . 100 . tailor 7  ; tailor reward
  7. set % . 110 . tailor 7  ; tailor reward
  8. set % . 125 . tailor 7  ; tailor reward
  9. set % . 150 . tailor 7  ; tailor reward
  10. set % . 160 . tailor 7  ; tailor reward



now i really do not want to load (set all the vars for all the bod type on every run of the script
the process will be,
1. have a loaded complted bod book(can be a mixture of all 8 bod types
2. walk up to the merchant area (no i will not be making it where it recalls to the bod givers\turnin. so i can automate the entire process) yet
3. start the script
4. script will then find merchants that i can turn in bod to and determine there type, ie tailor, blacksmith, tinker
5. here is when i want to load the particualr table
what is the proper way to load the particular reward table, should i use a gosub to those set commands or a goto, and have them available during the rest of the routine, and then if there is another different merchant in the area for different bods, it will load another table but remove the vars from the preivous table ( i assume using namespace in some sort of fashion)

so find tailor , loads those rewards from the table, finishes , but there is also a carpenter in the area, so would want to clear the tailor eward array, and load a carpenter array, want to keep it clean

and remember i am looking for suggestions not someone to write the code for me lol


Top
  Profile 
PostPosted: Thu Jun 07, 2018 1:27 am 
Offline
Administrator
Administrator
User avatar

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

Save each table in an own file and label them accordingly... Like tailor.euo, BS.euo, ...
Now you just call the used file and bam! your values are set.

_________________
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: Thu Jun 07, 2018 3:00 pm 
Offline
Legendary Scripter
Legendary Scripter
User avatar

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

You're just loading that data in at the beginning of the script. No need for separate files. ;) Just put it all in a massive file and load it all at setup. One file. You could also create a way to round down your point score to the nearest reward. Then make that reward. That's what I do... only if a bod isn't worth bribing up to a high end bod for combining easily, or a high end bod reward, I round down my points, to the nearest WORTHWHILE reward, so I only make rewards I want, while wasting the least amount of points, and that's all chosen on a menu. Mine also farms up the resources for filling the bods though too, individually, or by set amounts. So it could get a load of bods, and if they are fillable, or bribable, it would do that, then it goes to fill them, and if there aren't enough resources, it will either farm up what it needs, or farm up to an amount I set. After that, or it goes back to filling the bods. I'm also working on an addition, where it will recall/run around luna, and buy up any cheap bods it finds, or use the vendor search function to find bods that are cheap, and worth filling for low cost. With the ability to set what you're willing to pay. Fun script.

_________________
Image


Top
  ProfileShow poster's scripts in the public script library 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 8 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.