Advertisement
Guest User

Untitled

a guest
Aug 18th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.14 KB | None | 0 0
  1. #works to improve the sigil
  2. #quits with parse IMPROVE SIGIL FINISHED
  3.  
  4. ### Temporarily removing "difficult" as a selectable option
  5.  
  6.  
  7. #echo yellow --- USE AT YOUR OWN RISK: Beta Version, needs significant cleanup and much room for improvement once numbers are known ---
  8.  
  9. debug 0
  10. var verboseDebug 0
  11.  
  12. #Variables to edit
  13. # danger 1 - 20.
  14. # 0 means no improvement, 4-6 is moderate risk, 20 is gauranteed failure. 10 works well with the tech.
  15. var dangerThreshold 5
  16.  
  17.  
  18. #min/max quality is the range to target. Will ignore danger levels if lower than min and stop altogether if > max so as not to hit
  19.  
  20. #quality 0 - 99 (anything over 99 will be an unreachable target = wasted moves)
  21. # - Your max target. Higher numbers take points away from precision due to danger risks
  22. # - You generally want this to be very high, this is clarity
  23. # - storebought sigils are 70 quality. (as of recently changed)
  24. var maxQuality 99
  25. var minQuality 70
  26.  
  27. #precision 0 - 99 (anything over 99 will be an unreachable target = wasted moves)
  28. # - You generally want this to be just as high as the capacity on your item,
  29. # higher is a waste unless averaging other sigils to reach that target
  30. # - Low precision = low hardness + high workability.
  31. # High precision = high hardness + low workability
  32. # Storebought sigils are 20 precision
  33. # if working with store-bought totems, you only need a capacity of 40.
  34. # Use threshhold of 10 if working with store bought totems and another storebought sigil.
  35. # Use threshhold of 1 if working with store bought totems and two storebought sigils (why though?)
  36. var maxPrecision 70
  37. var minPrecision 51
  38.  
  39. ################################### General Information ###########################
  40. # Quality is the key stat for workorders
  41. # Precision is the key stat for potency or effectiveness, and it makes it harder to craft
  42. # Best workorder sigil = very high quality, low precision
  43.  
  44. ################################### ACTION DEFINITION ###########################
  45. #out of 0-100
  46. action var qualityLevel $1 when Clarity:(\d+)
  47. action var precisionLevel $1 when Precision:(\d+)
  48.  
  49. #0-20
  50. action eval sanityLevel count("$1","*") when Sanity: (\**)
  51. action eval resolveLevel count("$1","*") when Resolve: (\**)
  52. action eval focusLevel count("$1","*") when Focus: (\**)
  53. action eval dangerLevel count("$1","*") when Danger: (\**)
  54.  
  55.  
  56. #$1 = diffuclty (trivial -> straightforward -> challenging -> formidable -> difficult)
  57. #$2 = cost variable (resolve, sanity, focus)
  58. #$3 = [DROPPING - DOES NOTHING] cost amount (taxing -> disrupting -> destroying)
  59. #$4 = command [GUID - Unique key] (TECHNIQUE, FORM, APPROACH, ACTION, METHOD, PROCESS, RITUAL)
  60. #$5 = Amount improved (improving, enhancing, recovering, elevate)
  61. #$6 = Benefit (precision, quality, focus, sanity, resolve)
  62. action var Improve.Sigil.Action.$4 $1|$2|0|$4|$5|$6 when \.\.\.a (\w+), (\w+) (\w+) (\w+) [to|for]* (\w+) the sigil (\w+)
  63. action var Improve.Sigil.Action.$4 $1|$2|0|$4|$5|$6 when \.\.\.a (\w+), (\w+) (\w+) (\w+) [to|for]* (\w+) your (\w+)
  64.  
  65. #abort early
  66. action goto Improve.Sigil.EMPTY when You are unaware of any completely identified sigils in the area
  67. action goto Improve.Sigil.BLEWIT when You lose track of your surroundings
  68. action goto Improve.Sigil.TIMEOUT when You are unaware of any sigils in the area. First identify one before attempting to improve its detail.
  69. 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\.
  70.  
  71. ################################## MAIN FUNCTIONS ############################
  72. Improve.Sigil.Main.Start:
  73. gosub Improve.Sigil.InitVars
  74.  
  75. Improve.Sigil.Main.Loop:
  76. gosub Improve.Sigil.CheckDanger
  77. gosub Improve.Sigil.SetActionVars
  78. gosub Improve.Sigil.ConvertActionVars
  79. gosub Improve.Sigil.FindBestAction
  80. pause .05
  81. goto Improve.Sigil.Main.Loop
  82.  
  83. Improve.Sigil.SetActionVars:
  84. pause .05
  85. gosub Improve.Sigil.CleanActions
  86.  
  87. #find the options
  88. COUNTER ADD 1
  89. put %Improve.Sigil.nextAction
  90. waitfor Roundtime
  91.  
  92. pause $roundtime
  93. return
  94.  
  95. Improve.Sigil.FindBestAction:
  96. #trivial = 1, straightforward = 2, challenging = 3, formidable = 4, difficult = 5
  97. # originally did a pass on each difficulty, changed to numeric subs to do this with one pass.
  98. gosub Improve.Sigil.find.Generic 1
  99.  
  100. return
  101.  
  102. Improve.Sigil.find.Generic:
  103. pause .05
  104. var Improve.Sigil.find.Generic.difficulty $1
  105.  
  106. ######### IMPORTANT #########
  107. # THIS IS NOT OPTIMIZED #
  108. # THIS NEEDS TO BE IMPROVED #
  109. #############################
  110. var Improve.Sigil.nextAction per sigil improve
  111. var Improve.Sigil.find.Generic.best NULL
  112. var Improve.Sigil.find.Generic.difficulty 100
  113. var Improve.Sigil.find.Generic.cost 100
  114. if ((%qualityLevel >= %maxQuality) && (%precisionLevel >= %maxPrecision)) then {
  115. put #echo yellow Quality and Precision at or above threshhold levels
  116. put #echo yellow ... Quality = %qualityLevel with a target >= %maxQuality
  117. put #echo yellow ... Precision = %precisionLevel with a target >= %maxPrecision
  118. goto Improve.Sigil.END
  119. }
  120. if (%precisionLevel < %maxPrecision) then {
  121. gosub Improve.Sigil.find.Generic.TestVar ACTION precision
  122. gosub Improve.Sigil.find.Generic.TestVar APPROACH precision
  123. gosub Improve.Sigil.find.Generic.TestVar EFFORT precision
  124. gosub Improve.Sigil.find.Generic.TestVar FORM precision
  125. gosub Improve.Sigil.find.Generic.TestVar METHOD precision
  126. gosub Improve.Sigil.find.Generic.TestVar PROCESS precision
  127. gosub Improve.Sigil.find.Generic.TestVar RITUAL precision
  128. gosub Improve.Sigil.find.Generic.TestVar TASK precision
  129. gosub Improve.Sigil.find.Generic.TestVar TECHNIQUE precision
  130. } else {
  131. put #echo skipping precision - at or above target
  132. put #echo blue ... Precision = %precisionLevel with a target >= %maxPrecision
  133. }
  134. if (("%Improve.Sigil.find.Generic.best" = "NULL") && (%qualityLevel < %maxQuality)) then {
  135. gosub Improve.Sigil.find.Generic.TestVar ACTION quality
  136. gosub Improve.Sigil.find.Generic.TestVar APPROACH quality
  137. gosub Improve.Sigil.find.Generic.TestVar EFFORT quality
  138. gosub Improve.Sigil.find.Generic.TestVar FORM quality
  139. gosub Improve.Sigil.find.Generic.TestVar METHOD quality
  140. gosub Improve.Sigil.find.Generic.TestVar PROCESS quality
  141. gosub Improve.Sigil.find.Generic.TestVar RITUAL quality
  142. gosub Improve.Sigil.find.Generic.TestVar TASK quality
  143. gosub Improve.Sigil.find.Generic.TestVar TECHNIQUE quality
  144. } else {
  145. put #echo skipping Quality - working on precision or at or above target
  146. put #echo blue ... Quality = %qualityLevel with a target >= %maxQuality
  147. }
  148.  
  149. goto Improve.Sigil.find.Generic.Return
  150.  
  151.  
  152. #$1 = diffuclty (trivial -> straightforward -> challenging -> formidable -> difficult)
  153. #$2 = cost variable (resolve, sanity, focus)
  154. #$3 = [hard coded 0 - does nothing] cost amount (taxing -> disrupting -> destroying)
  155. #$4 = command [GUID - Unique key] (TECHNIQUE, FORM, APPROACH, ACTION, METHOD, PROCESS, RITUAL)
  156. #$5 = unclear if this does anything - Amount improved (improving, enhancing, recovering, elevate)
  157. #$6 = Benefit (precision, quality, focus, sanity, resolve)
  158.  
  159. #array values
  160. #difficulty |cost bucket| N/A1 | command | N/A2 | reward bucket
  161. # N/A1 = ignore - just text [old: cost]
  162. # N/A2 = ignore - just text [old: reward amount]
  163. #ie: trivial|focus|disrupting|METHOD|recovering|resolve
  164.  
  165. Improve.Sigil.find.Generic.TestVar:
  166. if (%verboseDebug = 1) then put #echo blue processing
  167. pause .05
  168. var Improve.Sigil.TestVar.element $1
  169. var Improve.Sigil.find.Generic.TestVar.keyValue $2
  170.  
  171. #confirm this is an action
  172. if ("%Improve.Sigil.Action.%Improve.Sigil.TestVar.element" = "NULL") then return
  173.  
  174. #clean the text
  175. var Improve.Sigil.ConvertActionVars.node Improve.Sigil.Action.%Improve.Sigil.TestVar.element
  176. gosub Improve.Sigil.ConvertActionVars Improve.Sigil.Action.%Improve.Sigil.TestVar.element
  177.  
  178. #store for easy access
  179. var Improve.Sigil.find.Generic.TestVar.array %Improve.Sigil.Action.%Improve.Sigil.TestVar.element
  180.  
  181.  
  182.  
  183. #check for key value on test node, currently only testing for precision or quality
  184. if ("%Improve.Sigil.find.Generic.TestVar.array(5)" = "%Improve.Sigil.find.Generic.TestVar.keyValue") then {
  185. if (%verboseDebug = 1) then put #echo green found a %Improve.Sigil.find.Generic.TestVar.keyValue node with action %Improve.Sigil.TestVar.element
  186.  
  187. #check cost slot 1 = bucket, slot 2 = amount
  188. 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(0)
  189.  
  190. #create a cost variable based on difficulty
  191. # Trivial = 1 to 3 est=2 success = 1-2, chaotic break = 3
  192. # Straightforward = 2 to 4 est=3 success = 2-3, chaotic break = 4
  193. # challenging = 4 to 5 est=4 success = 4-5, chaotic break = 4
  194. # formidable = 4 to 5 est=6 success = 4, chaotic break = _, fail = 3
  195. # difficult = 7 to 9 est=8 success = 8-9, chaotic break = _, fail = 7
  196. var TMP.sigil.poolCost.max %Improve.Sigil.find.Generic.TestVar.array(0)
  197.  
  198. ## NEW Feature if low danger, take bigger risks.
  199. if (%dangerLevel < 5 && %precisionLevel < %minPrecision && %qualityLevel < %minQuality) then {
  200. math TMP.sigil.poolCost.max subtract 1
  201. }
  202.  
  203. if (%%Improve.Sigil.find.Generic.TestVar.array(1)Level >= %TMP.sigil.poolCost.max) then {
  204. # how many points are in the bucket (sanity, resolve, focus) and how much does the move cost?
  205. 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(0)
  206. if (%verboseDebug = 1) then put #echo green .........have enough resources, checking if it's less cost than stored element
  207. if (%verboseDebug = 1) then put #echo purple .........(debug: stored cost = %Improve.Sigil.find.Generic.cost)
  208. if (%verboseDebug = 1) then put #echo purple .........(debug: test cost = %Improve.Sigil.find.Generic.TestVar.array(0))
  209. # check if tested element is cheaper than stored element.
  210. if (%Improve.Sigil.find.Generic.TestVar.array(0) < %Improve.Sigil.find.Generic.cost) then {
  211. if (%verboseDebug = 1) then put #echo green .........It's cheaper than the stored value -- (%Improve.Sigil.find.Generic.TestVar.array(0)) < (%Improve.Sigil.find.Generic.cost)
  212. gosub Improve.Sigil.find.Generic.TestVar.RegisterNewBestAction
  213. } else {
  214. # if not cheaper, is it equal cost?
  215. 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)
  216. # equal resource cost, test difficulty
  217. if (%Improve.Sigil.find.Generic.TestVar.array(2) = %Improve.Sigil.find.Generic.cost) then {
  218. #if equal cost, is it easier?
  219. 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)
  220. if (%Improve.Sigil.find.Generic.TestVar.array(0) < %Improve.Sigil.find.Generic.difficulty) then {
  221. gosub Improve.Sigil.find.Generic.TestVar.RegisterNewBestAction
  222. } else {
  223. if (%verboseDebug = 1) then put #echo yellow skipping - cost equal, but not easier
  224. }
  225. } else {
  226. if (%verboseDebug = 1) then put #echo yellow skipping - cost higher than existing option
  227. }
  228. }
  229.  
  230. } else {
  231. 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(0)
  232. if (%verboseDebug = 1) then put #echo yellow skipping - not enough resources to pull off
  233. }
  234. } else {
  235. #end result != target
  236. }
  237.  
  238. return
  239.  
  240. Improve.Sigil.find.Generic.TestVar.RegisterNewBestAction:
  241. pause .05
  242. if (%verboseDebug = 1) then {
  243. put #echo purple .........-----replacing value---------
  244. put #echo purple .........(old: %Improve.Sigil.find.Generic.best / new: %Improve.Sigil.TestVar.element)
  245. put #echo purple .........(old: %Improve.Sigil.find.Generic.best / new: %Improve.Sigil.TestVar.element)
  246. put #echo purple .........(old difficulty: %Improve.Sigil.find.Generic.difficulty / new: %Improve.Sigil.find.Generic.TestVar.array(0))
  247. put #echo purple .........(old action: %Improve.Sigil.nextAction / new action %Improve.Sigil.find.Generic.best
  248. }
  249. var Improve.Sigil.find.Generic.best %Improve.Sigil.TestVar.element
  250. var Improve.Sigil.find.Generic.difficulty %Improve.Sigil.find.Generic.TestVar.array(0)
  251. var Improve.Sigil.find.Generic.cost %Improve.Sigil.find.Generic.TestVar.array(0)
  252. var Improve.Sigil.nextAction per sigil %Improve.Sigil.find.Generic.best
  253. put #echo blue .... New best action %Improve.Sigil.nextAction
  254. return
  255.  
  256. Improve.Sigil.find.Generic.Return:
  257.  
  258. return
  259.  
  260.  
  261. Improve.Sigil.CheckDanger:
  262. if ((%dangerLevel >= %dangerThreshold) && (%qualityLevel>=%minQuality) && (%precisionLevel>= %minPrecision)) then {
  263. put #echo >Log green danger too high (%dangerLevel / %dangerThreshold), harvesting (p: %precisionLevel, q: %qualityLevel)
  264. goto Improve.Sigil.END
  265. } else {
  266. put #echo green Keep going d:%dangerLevel (of %dangerThreshold), q: %qualityLevel (min:%minQuality max: %maxQuality), p: %precisionLevel (min: %minPrecision, max: %maxPrecision )
  267. }
  268. #if (%qualityLevel > 0 and %qualityLevel < %maxQuality) then {
  269. # put #echo quality too low, harvesting
  270. # goto Improve.Sigil.END
  271. # ########## IMPORTANT ##########
  272. # # THIS IS NOT OPTIMIZED #
  273. # # Script should fix quality #
  274. # ###############################
  275. #
  276. #}
  277. return
  278.  
  279. #converts the text to numeric values for easy comparison
  280. Improve.Sigil.ConvertActionVars:
  281.  
  282. ########## IMPORTANT ##########
  283. # THIS IS NOT OPTIMIZED #
  284. # THIS NEEDS TO BE IMPROVED #
  285. # Potentially combine replaces#
  286. ###############################
  287.  
  288.  
  289. pause .05
  290. var Improve.Sigil.ConvertActionVars.name $1
  291.  
  292. ## Set to > 100 to turn off this difficulty
  293.  
  294. #difficulty
  295. eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "trivial", "2")
  296. eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "straightforward", "3")
  297. eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "challenging", "4")
  298. eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "formidable", "6")
  299. eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "difficult", "8")
  300.  
  301. # eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "difficult", "105")
  302.  
  303. #cost
  304. #eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "disrupting", "3")
  305. #eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "taxing", "4")
  306. #eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "destroying", "8")
  307.  
  308. #cost
  309. eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "improving", "1")
  310. eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "enhancing", "2")
  311. eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "recovering", "3")
  312. eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "elevate", "4")
  313.  
  314. return
  315.  
  316.  
  317. ########################## ERROR AND EXIT FUNCTIONS ######################
  318.  
  319. Improve.Sigil.TIMEOUT:
  320. put #echo red >Log Script hung. Exiting
  321. goto Improve.Sigil.END
  322.  
  323. Improve.Sigil.BLEWIT:
  324. put #echo red >Log Sigil FAIL (%1) Steps:%c, Q:%qualityLevel, P:%precisionLevel
  325. goto Improve.Sigil.END
  326.  
  327. Improve.Sigil.EMPTY:
  328. put #echo >SigilLog room empty, shorting out of sigil improve early.
  329. goto Improve.Sigil.END
  330.  
  331. Improve.Sigil.END:
  332. put #echo >sigillog Improve Finish (%1): Steps:%c, Q:%qualityLevel, P:%precisionLevel
  333. put #parse IMPROVE SIGIL FINISHED
  334.  
  335. exit
  336.  
  337.  
  338. ################ CLEAN ACTIONS ####################
  339. Improve.Sigil.InitVars:
  340. pause .05
  341. put #echo blue zeroing out sigil levels
  342. var dangerLevel 0
  343. var sanityLevel 0
  344. var resolveLevel 0
  345. var focusLevel 0
  346. var qualityLevel 0
  347. var precisionLevel 0
  348.  
  349. var Improve.Sigil.nextAction per sigil improve
  350. var sigilName NULL
  351. COUNTER set 0
  352.  
  353. return
  354.  
  355. Improve.Sigil.CleanActions:
  356.  
  357. ############ IMPORTANT ############
  358. # THIS IS POORLY IMPLEMENTED #
  359. # Replace with a new array, #
  360. # 2 separating characters #
  361. # one for inner, one outer #
  362. ###################################
  363.  
  364. var Improve.Sigil.Action.ACTION NULL
  365. var Improve.Sigil.Action.APPROACH NULL
  366. var Improve.Sigil.Action.EFFORT NULL
  367. var Improve.Sigil.Action.FORM NULL
  368. var Improve.Sigil.Action.METHOD NULL
  369. var Improve.Sigil.Action.PROCESS NULL
  370. var Improve.Sigil.Action.RITUAL NULL
  371. var Improve.Sigil.Action.TASK NULL
  372. var Improve.Sigil.Action.TECHNIQUE NULL
  373.  
  374. var Improve.Sigil.NextBestAction NULL
  375. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement