Total players online: 12



Take the Tour | Site Map

It is currently Mon Sep 24, 2018 7:27 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: Tue Jan 24, 2017 9:12 pm 
Offline
Script Kiddie
Script Kiddie

Joined: 02/22/2015 04:21
Posts: 3
I have this old mining script... I take no credit for scripting it, I just learned what i could and morphed it to work with my needs.
Now it works perfectly as it should. I explain how it works as far as i can tell.
Click start, it mines a spot, then path finds to another spot ect ect, you set forge coordinates, and it auto smelts. then keeps mining.
Once you are over weight or damn near close. It will follow the coordinates at the bottom of the script.
I have it set up to Mine, then run out sight and use a locked down chest on the steps of a house RIGHT outside of the mine.

Now it works perfectly. Only Every time it finished banking the smelted ingots....

It pathfinds its self back into the mine just as it should...

But then cycles and repeats the banking...

It runs out banks ingots, runs back into mine, path finds.. path finds, path finds, and finds its self back at the bank ( my locked down chest at the house)
runs back into the mine, does the same thing rinse lather and repeat, it restart the script after banking the ingots..

I am at my witts end i have tried goto this or gosub this and that, not sure what im missing..

I am sure it can't be that complicated i hope lol. Anyone here have any ideas? here's the script..
Code:
  1. ; ============= User variables and instructions ================================
  2. ; YOU WILL NEED TO CHANGE THE ID VALUES BELOW TO MATCH YOUR CHARACTERS CONTAINERS
  3. ; OR AUTOMATIC BANKING WON'T WORK CORRECTLY!
  4.  
  5. ; You can find out ID of a container by having EUO running and opening a container.
  6. ; Right side of EUO window there should be "Container Info" as a folded menu and
  7. ; there #CONTID variable now holds the information. For example LHUGMMD
  8.  
  9. ; Change this to the ID of container in your bank where you would like
  10. ; your ingots to be placed.
  11. set %ingotContainer ZFQUPMD
  12.  
  13. ; Change this to whatever ID your bank container has.
  14. set %bankcontainerID CGQUPMD
  15.  
  16. ; ================================================== ============================
  17.  
  18. set %forgePosX 1804
  19. set %forgePosY 1024
  20. set %ingotTypes RMK_BVI
  21. set %forgeTypes JBG_JJ_SMF
  22. set %toolTypes QPF
  23. set %status idle
  24. set %bankID CGQUPMD
  25. set %DebugMode #true
  26.  
  27. event sysmessage Starting OzMining 1.0
  28.  
  29. {
  30. gosub GoSmelt
  31. if %status = no_more_ore
  32. {
  33. set %status idle
  34. goto MoveToNextSpot
  35. }
  36. gosub GoSmelt
  37. set %jrnl #jindex
  38. gosub MineThisSpot
  39. gosub ProcessResults
  40. }
  41. ; Player dead: stopping macro after making some racket..
  42. sound Windows XP critical stop.wav
  43. wait 2s
  44. sound Windows XP critical stop.wav
  45. wait 2s
  46. sound Windows XP critical stop.wav
  47. wait 2s
  48.  
  49. sub MineThisSpot
  50. if ( %status <> idle )
  51. finditem %tooltypes C
  52. {
  53. target 20s
  54.  
  55. set %status mining
  56. }
  57.  
  58. sub ProcessResults
  59. while %status = mining
  60. {
  61. if #jindex > %jrnl
  62. {
  63. set %jrnl %jrnl + 1
  64. if you_dig_some in #journal
  65. set %status idle
  66. if you_loosen_some_rocks in #journal
  67. set %status idle
  68. if World_save_complete in #journal
  69. set %status idle
  70. if You_have_moved_too_far in #journal
  71. set %status idle
  72. if Someone_has_gotten in #journal
  73. set %status idle
  74. if Can't_mine_that in #journal
  75. set %status idle
  76. if target_cannot_be_seen in #journal
  77. {
  78. set %status no_more_ore
  79. gosub MoveToNextSpot
  80. }
  81. if there_is_no_metal_here_to_mine in #journal
  82. {
  83. set %status no_more_ore
  84. gosub MoveToNextSpot
  85. }
  86. if you_can't_mine_that in #journal
  87. {
  88. set %status no_more_ore
  89. gosub MoveToNextSpot
  90. }
  91. if world_save_complete. in #journal
  92. {
  93. set %status no_more_ore
  94. gosub MoveToNextSpot
  95. }
  96. if that_is_too_far_away in #journal
  97. {
  98. set %status no_more_ore
  99. gosub MoveToNextSpot
  100. }
  101. if for_validating_your_presence in #journal
  102. {
  103. set %status no_more_ore
  104. gosub MoveToNextSpot
  105. }
  106. }
  107. }
  108.  
  109. sub MoveToNextSpot
  110. if ( %DegugMode )
  111. event sysmessage ++ Trying to find a new location to mine...
  112.  
  113. FindNextSpot:
  114. set %GotoX #charposX
  115. set %GotoY #charposY
  116.  
  117. set %randomInc #random % 5
  118. ; negative or positive?
  119. set %nDirection #random % 2
  120. if %nDirection = 1
  121. set %randomInc %randomInc * -1
  122. set %GotoX %GotoX + %randomInc
  123.  
  124. ; Random amount of tiles to a direction
  125. set %randomInc #random % 5
  126. ; negative or positive?
  127. set %nDirection #random % 2
  128. if %nDirection = 1
  129. set %randomInc %randomInc * -1
  130. set %GotoY %GotoY + %randomInc
  131.  
  132. if ( %DegugMode )
  133. event sysmessage -- Initializing tile info...
  134. tile Get %GotoX %GotoY 2
  135. if ( %DegugMode )
  136. if ( #tilename = cave_floor )
  137. {
  138. if ( %DegugMode )
  139. event sysmessage Found cave location...
  140. event pathFind %GotoX %GotoY
  141. wait 10
  142. if ( #charposX = %oldX && #charposY = %oldY )
  143. goto FindNextSpot
  144. }
  145. if ( #charposX <> %oldX && #charposY <> %oldY )
  146. if ( #charposX = %GotoX && #charposY = %GotoY )
  147. set %status idle
  148. goto FindNextSpot
  149.  
  150. sub GoSmelt
  151. SmeltOre:
  152.  
  153. event pathFind %forgePosX %forgePosY
  154. wait 1s
  155. if ( #charposX = %oldX && #charposY = %oldY )
  156. goto SmeltOre
  157. CheckForMoreOre:
  158. finditem DWJ C
  159. {
  160. goto CheckForMoreOre
  161. }
  162. wait 1s
  163. if ( #weight > #maxweight - 50 )
  164. gosub BankOre
  165. GoBack:
  166. event pathFind %oldX %oldY
  167. wait 1s
  168. if ( #charposX = %forgePosX && #charposY = %forgePosY )
  169. goto GoBack
  170.  
  171. sub BankOre
  172. if ( %DegugMode )
  173. event sysmessage ++ Going to bank ingots...
  174. BankingStep1:
  175. event pathFind 1799 1031
  176. wait 1s
  177. if ( #CHARPOSX <> 1799 && #CHARPOSX <> 1031 )
  178. goto BankingStep1
  179. BankingStep2:
  180. event pathFind 1817 1029
  181. wait 1s
  182. if ( #CHARPOSX <> 1817 && #CHARPOSX <> 1029 )
  183. goto BankingStep2
  184. BankingStep3:
  185. event pathFind 1828 1031
  186. wait 1s
  187. if ( #CHARPOSX <> 1828 && #CHARPOSX <> 1031 )
  188. goto BankingStep3
  189. Openbank:
  190. set #LOBJECTID %bankID
  191. wait 10
  192. if ( #CONTID <> %bankcontainerID )
  193. goto Openbank
  194. BankMore:
  195. finditem %ingotTypes C
  196. {
  197. wait 10
  198. Exevent Dropc %ingotContainer
  199. wait 10
  200. goto BankMore
  201. }
  202. wait 1s
  203. event sysmessage ++ Going back...
  204. GoingBackStep1:
  205. event pathFind 1817 1029 0
  206. wait 2s
  207. if ( #CHARPOSX <> 1817 && #CHARPOSX <> 1029 )
  208. goto GoingBackStep1
  209. GoingBackStep2:
  210. event pathFind 1799 1031
  211. wait 2s
  212. if ( #CHARPOSX <> 1799 && #CHARPOSX <> 1031 )
  213. goto GoingBackStep2
  214. GoingBackStep3:
  215. event pathFind %forgePosX %forgePosY
  216. wait 2s
  217. if ( #CHARPOSX <> %forgePosX && #CHARPOSX <> %forgePosY )
  218. goto GoingBackStep3


Top
  Profile 
PostPosted: Wed Jan 25, 2017 6:06 pm 
Offline
Script Scribe
Script Scribe

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

Groups:
I"m confused, how does it keep banking ingots unless it's also mining and smelting ? You say it goes back and banks the ingots then it pathfinds......and banks the ingots...where's the issue ?


Top
  Profile 
PostPosted: Thu Jan 26, 2017 12:36 am 
Offline
Administrator
Administrator
User avatar

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

i second that.. By what you tell, all works good and as it should:
Mining, smelting, banking, repeat

_________________
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 31, 2017 6:36 pm 
Offline
Script Kiddie
Script Kiddie

Joined: 02/22/2015 04:21
Posts: 3
I guess i didn't explain that properly.

Once it the character is full the first time, it runs to the bank and then banks the ingots.

After that it just keeps pathfinding back into the mine... then path finds back to the bank box.
Then pathfinds back into the mine. Then path finds back to the bank box..
rinse lather repeat.
Untill I stop the script. Run back into the mine, then click play again.

It will mine and smelt properly until its weight check. then run to the bank bank the ingots properly.

Then it will again path find back into the mine, do nothing and path find back to the bank over and over and over.

Not sure why it won't just bank the ingots. path find back to the mine. then start mining again...


Top
  Profile 
PostPosted: Tue Jan 31, 2017 7:49 pm 
Offline
Script Kiddie
Script Kiddie

Joined: 02/22/2015 04:21
Posts: 3
Apparently the very last section of the script is all i can figure out is what is causing this pathfinding looping error and can't seem to get the script to go back to mining after it banks.. it just path finds back to the mine... then SHOULD start mining again, but instead just path finds back to the bank, then back to the mine then back to the bank over and over lol

Anyone see a problem here?

event sysmessage ++ Going back...
GoingBackStep1:
event pathFind 1817 1029 0
wait 2s
if ( #CHARPOSX <> 1817 && #CHARPOSX <> 1029 )
goto GoingBackStep1
GoingBackStep2:
event pathFind 1799 1031
wait 2s
if ( #CHARPOSX <> 1799 && #CHARPOSX <> 1031 )
goto GoingBackStep2
GoingBackStep3:
event pathFind 1828 1031 0
wait 2s
if ( #CHARPOSX <> 1828 && #CHARPOSX <> 1031 )
goto GoingBackStep3
goto smelt
event pathFind %forgePosX %forgePosY
wait 2s
if ( #CHARPOSX <> %forgePosX && #CHARPOSX <> %forgePosY )
set #LPC 10
return


Top
  Profile 
PostPosted: Wed Feb 01, 2017 1:30 am 
Offline
Administrator
Administrator
User avatar

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

hardcoded rails, Gotos... Uh...

This snippet walks a 3-node rail and jumps (propably out of the sub which can break a script by itself) to smelt. I dont see any mining activity in there...

_________________
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 Feb 01, 2017 6:48 am 
Offline
Adept Scripter
Adept Scripter

Joined: 03/06/2006 09:28
Posts: 192

Groups:
There looks to be an issue with the very last if statement:
girthzilla wrote:
if ( #CHARPOSX <> %forgePosX && #CHARPOSX <> %forgePosY )
set #LPC 10
return


specifically: && #CHARPOSX <> %forgePosY

You are checking the X pos of your char with the Y forge pos... maybe an issue?

_________________
KEEP IT GRIM


Top
  Profile 
PostPosted: Wed Feb 01, 2017 8:53 am 
Offline
Adept Scripter
Adept Scripter

Joined: 03/06/2006 09:28
Posts: 192

Groups:
Also, at the top of your script you have the following:
Code:
  1.  
  2.         if %status = no_more_ore
  3.            {
  4.            set %status idle
  5.            goto MoveToNextSpot
  6.            }
  7.  

Judging by the rest of the script the GoTo command should be a GoSub

_________________
KEEP IT GRIM


Top
  Profile 
PostPosted: Thu Feb 02, 2017 3:35 am 
Offline
Administrator
Administrator
User avatar

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

  1. if ( #CHARPOSX <> %forgePosX && #CHARPOSX <> %forgePosY )
This checks if you are not sitting on the same tile as the forge... AFAIK you can not walk INTO a forge... so this statement will always evaluate as true as you can not walk into a forge...

_________________
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 Feb 02, 2017 6:57 am 
Offline
Adept Scripter
Adept Scripter

Joined: 03/06/2006 09:28
Posts: 192

Groups:
Orngrimm wrote:
  1. if ( #CHARPOSX <> %forgePosX && #CHARPOSX <> %forgePosY )
This checks if you are not sitting on the same tile as the forge... AFAIK you can not walk INTO a forge... so this statement will always evaluate as true as you can not walk into a forge...


probably has co-ords next to the forge marked but I rekon the last check is wrong it is unlikely that X = Y save for along a diagonal line on the map

_________________
KEEP IT GRIM


Top
  Profile 
PostPosted: Thu Feb 02, 2017 12:20 pm 
Offline
Administrator
Administrator
User avatar

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

Yes. This as well... :)

_________________
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 
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 13 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.