Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.79 KB | None | 0 0
  1. #works to improve the sigil
  2. #quits with parse IMPROVE SIGIL FINISHED
  3.  
  4. #echo yellow --- USE AT YOUR OWN RISK: Alpha Version, Disruption numbers are off - much room for improvement ---
  5.  
  6. debug 0
  7. var verboseDebug 0
  8.  
  9. #Variables to edit
  10. # danger threshould out of 20
  11. var dangerThreshold 4
  12.  
  13. #quality 0 - 100
  14. var qualityThreshold 30
  15.  
  16.  
  17.  
  18. ################################### General Information ###########################
  19. # Quality is the key stat for workorders
  20. # Precision is the key stat for potency or effectiveness, and it makes it harder to craft
  21. # Best workorder sigil = very high quality, low precision
  22.  
  23. ################################### ACTION DEFINITION ###########################
  24. #out of 0-100
  25. action var qualityLevel $1 when Clarity:(\d+)
  26. action var precisionLevel $1 when Precision:(\d+)
  27.  
  28. #0-20
  29. action eval sanityLevel count("$1","*") when Sanity: (\**)
  30. action eval resolveLevel count("$1","*") when Resolve: (\**)
  31. action eval focusLevel count("$1","*") when Focus: (\**)
  32. action eval dangerLevel count("$1","*") when Danger: (\**)
  33.  
  34.  
  35. #$1 = diffuclty (trivial -> straightforward -> challenging -> formidable -> difficult)
  36. #$2 = cost variable (resolve, sanity, focus)
  37. #$3 = cost amount (taxing -> disrupting -> destroying)
  38. #$4 = command [GUID - Unique key] (TECHNIQUE, FORM, APPROACH, ACTION, METHOD, PROCESS, RITUAL)
  39. #$5 = Amount improved (improving, enhancing, recovering, elevate)
  40. #$6 = Benefit (precision, quality, focus, sanity, resolve)
  41. action var Improve.Sigil.Action.$4 $1|$2|$3|$4|$5|$6 when \.\.\.a (\w+), (\w+) (\w+) (\w+) [to|for]* (\w+) the sigil (\w+)
  42. action var Improve.Sigil.Action.$4 $1|$2|$3|$4|$5|$6 when \.\.\.a (\w+), (\w+) (\w+) (\w+) [to|for]* (\w+) your (\w+)
  43.  
  44. #abort early
  45. action goto Improve.Sigil.EMPTY when You are unaware of any completely identified sigils in the area
  46. action goto Improve.Sigil.TIMEOUT when You lose track of your surroundings
  47. action goto Improve.Sigil.TIMEOUT when You are unaware of any sigils in the area. First identify one before attempting to improve its detail.
  48. action goto Improve.Sigil.BLEWIT action goto Improve.Sigil.BLEWIT when the sigil is nowhere to be found now|With dismay you ponder|removing all traces of the sigil|No traces of the sigil remain\.
  49.  
  50. ################################## MAIN FUNCTIONS ############################
  51. Improve.Sigil.Main.Start:
  52. gosub Improve.Sigil.InitVars
  53.  
  54. Improve.Sigil.Main.Loop:
  55. gosub Improve.Sigil.CheckDanger
  56. gosub Improve.Sigil.SetActionVars
  57. gosub Improve.Sigil.ConvertActionVars
  58. gosub Improve.Sigil.FindBestAction
  59. pause .05
  60. goto Improve.Sigil.Main.Loop
  61.  
  62. Improve.Sigil.SetActionVars:
  63. pause .05
  64. gosub Improve.Sigil.CleanActions
  65.  
  66. #find the options
  67. COUNTER ADD 1
  68. put %Improve.Sigil.nextAction
  69. waitfor Roundtime
  70.  
  71. pause $roundtime
  72. return
  73.  
  74. Improve.Sigil.FindBestAction:
  75. #trivial = 1, straightforward = 2, challenging = 3, formidable = 4, difficult = 5
  76. # originally did a pass on each difficulty, changed to numeric subs to do this with one pass.
  77. gosub Improve.Sigil.find.Generic 1
  78.  
  79. return
  80.  
  81. Improve.Sigil.find.Generic:
  82. pause .05
  83. var Improve.Sigil.find.Generic.difficulty $1
  84.  
  85. ######### IMPORTANT #########
  86. # THIS IS NOT OPTIMIZED #
  87. # THIS NEEDS TO BE IMPROVED #
  88. #############################
  89. var Improve.Sigil.nextAction per sigil improve
  90. var Improve.Sigil.find.Generic.best NULL
  91. var Improve.Sigil.find.Generic.difficulty 100
  92. var Improve.Sigil.find.Generic.cost 100
  93.  
  94. gosub Improve.Sigil.find.Generic.TestVar ACTION precision
  95. gosub Improve.Sigil.find.Generic.TestVar APPROACH precision
  96. gosub Improve.Sigil.find.Generic.TestVar EFFORT precision
  97. gosub Improve.Sigil.find.Generic.TestVar FORM precision
  98. gosub Improve.Sigil.find.Generic.TestVar METHOD precision
  99. gosub Improve.Sigil.find.Generic.TestVar PROCESS precision
  100. gosub Improve.Sigil.find.Generic.TestVar RITUAL precision
  101. gosub Improve.Sigil.find.Generic.TestVar TASK precision
  102. gosub Improve.Sigil.find.Generic.TestVar TECHNIQUE precision
  103.  
  104. if ("%Improve.Sigil.find.Generic.best" = "NULL" && %qualityLevel < 95) then {
  105. gosub Improve.Sigil.find.Generic.TestVar ACTION quality
  106. gosub Improve.Sigil.find.Generic.TestVar APPROACH quality
  107. gosub Improve.Sigil.find.Generic.TestVar EFFORT quality
  108. gosub Improve.Sigil.find.Generic.TestVar FORM quality
  109. gosub Improve.Sigil.find.Generic.TestVar METHOD quality
  110. gosub Improve.Sigil.find.Generic.TestVar PROCESS quality
  111. gosub Improve.Sigil.find.Generic.TestVar RITUAL quality
  112. gosub Improve.Sigil.find.Generic.TestVar TASK quality
  113. gosub Improve.Sigil.find.Generic.TestVar TECHNIQUE quality
  114. }
  115. goto Improve.Sigil.find.Generic.Return
  116.  
  117.  
  118. #$1 = diffuclty (trivial -> straightforward -> challenging -> formidable -> difficult)
  119. #$2 = cost variable (resolve, sanity, focus)
  120. #$3 = cost amount (taxing -> disrupting -> destroying)
  121. #$4 = command [GUID - Unique key] (TECHNIQUE, FORM, APPROACH, ACTION, METHOD, PROCESS, RITUAL)
  122. #$5 = Amount improved (improving, enhancing, recovering, elevate)
  123. #$6 = Benefit (precision, quality, focus, sanity, resolve)
  124.  
  125. #array values
  126. #difficulty |cost bucket| cost | command | reward amount | reward bucket
  127. #ie: trivial|focus|disrupting|METHOD|recovering|resolve
  128.  
  129. Improve.Sigil.find.Generic.TestVar:
  130. put #echo blue processing
  131. pause .05
  132. var Improve.Sigil.TestVar.element $1
  133. var Improve.Sigil.find.Generic.TestVar.keyValue $2
  134.  
  135. #confirm this is an action
  136. if ("%Improve.Sigil.Action.%Improve.Sigil.TestVar.element" = "NULL") then return
  137.  
  138. #clean the text
  139. var Improve.Sigil.ConvertActionVars.node Improve.Sigil.Action.%Improve.Sigil.TestVar.element
  140. gosub Improve.Sigil.ConvertActionVars Improve.Sigil.Action.%Improve.Sigil.TestVar.element
  141.  
  142. #store for easy access
  143. var Improve.Sigil.find.Generic.TestVar.array %Improve.Sigil.Action.%Improve.Sigil.TestVar.element
  144.  
  145.  
  146.  
  147. #check for key value on test node, currently only testing for precision or quality
  148. if ("%Improve.Sigil.find.Generic.TestVar.array(5)" = "%Improve.Sigil.find.Generic.TestVar.keyValue" ) then {
  149. if (%verboseDebug = 1) then put #echo green found a %Improve.Sigil.find.Generic.TestVar.keyValue node with action %Improve.Sigil.TestVar.element
  150.  
  151. #check cost slot 1 = bucket, slot 2 = amount
  152. if (%verboseDebug = 1) then put #echo green ... Found accurate key (precision or quality), now testing %%Improve.Sigil.find.Generic.TestVar.array(1)Level >= %Improve.Sigil.find.Generic.TestVar.array(2)
  153.  
  154. if (%%Improve.Sigil.find.Generic.TestVar.array(1)Level >= %Improve.Sigil.find.Generic.TestVar.array(2)) then {
  155. # how many points are in the bucket (sanity, resolve, focus) and how much does the move cost?
  156. if (%verboseDebug = 1) then put #echo green ...... bucket: %Improve.Sigil.find.Generic.TestVar.array(1) contains %%Improve.Sigil.find.Generic.TestVar.array(1)Level - move requires %Improve.Sigil.find.Generic.TestVar.array(2)
  157. if (%verboseDebug = 1) then put #echo green .........have enough resources, checking if it's less cost than stored element
  158. if (%verboseDebug = 1) then put #echo purple .........(debug: stored cost = %Improve.Sigil.find.Generic.cost)
  159. if (%verboseDebug = 1) then put #echo purple .........(debug: test cost = %Improve.Sigil.find.Generic.TestVar.array(2))
  160. # check if tested element is cheaper than stored element.
  161. if (%Improve.Sigil.find.Generic.TestVar.array(2) < %Improve.Sigil.find.Generic.cost) then {
  162. if (%verboseDebug = 1) then put #echo green .........It's cheaper than the stored value -- (%Improve.Sigil.find.Generic.TestVar.array(2)) < (%Improve.Sigil.find.Generic.cost)
  163. gosub Improve.Sigil.find.Generic.TestVar.RegisterNewBestAction
  164. } else {
  165. # if not cheaper, is it equal cost?
  166. if (%verboseDebug = 1) then put #echo green ......not cheaper. Stored value (%Improve.Sigil.find.Generic.TestVar.array(2)) tested value (%Improve.Sigil.find.Generic.cost)
  167. # equal resource cost, test difficulty
  168. if (%Improve.Sigil.find.Generic.TestVar.array(2) = %Improve.Sigil.find.Generic.cost) then {
  169. #if equal cost, is it easier?
  170. if (%verboseDebug = 1) then put #echo green ..........Since equal, testing if new difficulty (%Improve.Sigil.find.Generic.TestVar.array(0)) < existing difficulty (%Improve.Sigil.find.Generic.difficulty)
  171. if (%Improve.Sigil.find.Generic.TestVar.array(0) < %Improve.Sigil.find.Generic.difficulty) then {
  172. gosub Improve.Sigil.find.Generic.TestVar.RegisterNewBestAction
  173. } else {
  174. if (%verboseDebug = 1) then put #echo yellow skipping - cost equal, but not easier
  175. }
  176. } else {
  177. if (%verboseDebug = 1) then put #echo yellow skipping - cost higher than existing option
  178. }
  179. }
  180.  
  181. } else {
  182. if (%verboseDebug = 1) then put #echo green ...... bucket (%Improve.Sigil.find.Generic.TestVar.element): %Improve.Sigil.find.Generic.TestVar.array(1) contains %%Improve.Sigil.find.Generic.TestVar.array(1)Level - move requires %Improve.Sigil.find.Generic.TestVar.array(2)
  183. if (%verboseDebug = 1) then put #echo yellow skipping - not enough resources to pull off
  184. }
  185. } else {
  186. #end result != target
  187. }
  188.  
  189. return
  190.  
  191. Improve.Sigil.find.Generic.TestVar.RegisterNewBestAction:
  192. pause .05
  193. if (%verboseDebug = 1) then {
  194. put #echo purple .........-----replacing value---------
  195. put #echo purple .........(old: %Improve.Sigil.find.Generic.best / new: %Improve.Sigil.TestVar.element)
  196. put #echo purple .........(old: %Improve.Sigil.find.Generic.best / new: %Improve.Sigil.TestVar.element)
  197. put #echo purple .........(old difficulty: %Improve.Sigil.find.Generic.difficulty / new: %Improve.Sigil.find.Generic.TestVar.array(0))
  198. put #echo purple .........(old action: %Improve.Sigil.nextAction / new action %Improve.Sigil.find.Generic.best
  199. }
  200. var Improve.Sigil.find.Generic.best %Improve.Sigil.TestVar.element
  201. var Improve.Sigil.find.Generic.difficulty %Improve.Sigil.find.Generic.TestVar.array(0)
  202. var Improve.Sigil.find.Generic.cost %Improve.Sigil.find.Generic.TestVar.array(2)
  203. var Improve.Sigil.nextAction per sigil %Improve.Sigil.find.Generic.best
  204. put #echo blue .... New best action %Improve.Sigil.nextAction
  205. return
  206.  
  207. Improve.Sigil.find.Generic.Return:
  208.  
  209. return
  210.  
  211. Improve.Sigil.CheckDanger:
  212. if %dangerLevel > %dangerThreshold then {
  213. put #echo green danger too high, harvesting
  214. goto Improve.Sigil.END
  215. }
  216. #if (%qualityLevel > 0 and %qualityLevel < %qualityThreshold) then {
  217. # put #echo quality too low, harvesting
  218. # goto Improve.Sigil.END
  219. # ########## IMPORTANT ##########
  220. # # THIS IS NOT OPTIMIZED #
  221. # # Script should fix quality #
  222. # ###############################
  223. #
  224. #}
  225. return
  226.  
  227. #converts the text to numeric values for easy comparison
  228. Improve.Sigil.ConvertActionVars:
  229.  
  230. ########## IMPORTANT ##########
  231. # THIS IS NOT OPTIMIZED #
  232. # THIS NEEDS TO BE IMPROVED #
  233. # Potentially combine replaces#
  234. ###############################
  235.  
  236.  
  237. pause .05
  238. var Improve.Sigil.ConvertActionVars.name $1
  239.  
  240. #difficulty
  241. eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "trivial", "1")
  242. eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "straightforward", "2")
  243. eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "challenging", "3")
  244. eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "formidable", "4")
  245. eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "difficult", "5")
  246.  
  247. #cost
  248. eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "disrupting", "3")
  249. eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "taxing", "4")
  250. eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "destroying", "8")
  251.  
  252. #cost
  253. eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "improving", "1")
  254. eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "enhancing", "2")
  255. eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "recovering", "3")
  256. eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "elevate", "4")
  257.  
  258. return
  259.  
  260.  
  261. ########################## ERROR AND EXIT FUNCTIONS ######################
  262.  
  263. Improve.Sigil.TIMEOUT:
  264. put #echo red >Log Script hung. Exiting
  265. goto Improve.Sigil.END
  266.  
  267. Improve.Sigil.BLEWIT:
  268. put #echo red >Log You blew up a sigil.
  269. goto Improve.Sigil.END
  270.  
  271. Improve.Sigil.EMPTY:
  272. put #echo >SigilLog room empty, shorting out of sigil improve early.
  273. goto Improve.Sigil.END
  274.  
  275. Improve.Sigil.END:
  276. put #echo >sigillog Improve Finish: Steps:%c, Q:%qualityLevel, P:%precisionLevel
  277. put #parse IMPROVE SIGIL FINISHED
  278.  
  279. exit
  280.  
  281.  
  282. ################ CLEAN ACTIONS ####################
  283. Improve.Sigil.InitVars:
  284. pause .05
  285. put #echo blue zeroing out sigil levels
  286. var dangerLevel 0
  287. var sanityLevel 0
  288. var resolveLevel 0
  289. var focusLevel 0
  290. var qualityLevel 0
  291. var precisionLevel 0
  292.  
  293. var Improve.Sigil.nextAction per sigil improve
  294. var sigilName NULL
  295. COUNTER set 0
  296.  
  297. return
  298.  
  299. Improve.Sigil.CleanActions:
  300.  
  301. ############ IMPORTANT ############
  302. # THIS IS POORLY IMPLEMENTED #
  303. # Replace with a new array, #
  304. # 2 separating characters #
  305. # one for inner, one outer #
  306. ###################################
  307.  
  308. var Improve.Sigil.Action.ACTION NULL
  309. var Improve.Sigil.Action.APPROACH NULL
  310. var Improve.Sigil.Action.EFFORT NULL
  311. var Improve.Sigil.Action.FORM NULL
  312. var Improve.Sigil.Action.METHOD NULL
  313. var Improve.Sigil.Action.PROCESS NULL
  314. var Improve.Sigil.Action.RITUAL NULL
  315. var Improve.Sigil.Action.TASK NULL
  316. var Improve.Sigil.Action.TECHNIQUE NULL
  317.  
  318. var Improve.Sigil.NextBestAction NULL
  319. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement