Advertisement
Guest User

Untitled

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