Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #works to improve the sigil
- #quits with parse IMPROVE SIGIL FINISHED
- ### Temporarily removing "difficult" as a selectable option
- #echo yellow --- USE AT YOUR OWN RISK: Beta Version, needs significant cleanup and much room for improvement once numbers are known ---
- debug 0
- var verboseDebug 0
- #Variables to edit
- # danger 1 - 20.
- # 0 means no improvement, 4-6 is moderate risk, 20 is gauranteed failure. 10 works well with the tech.
- var dangerThreshold 5
- #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
- #quality 0 - 99 (anything over 99 will be an unreachable target = wasted moves)
- # - Your max target. Higher numbers take points away from precision due to danger risks
- # - You generally want this to be very high, this is clarity
- # - storebought sigils are 70 quality. (as of recently changed)
- var maxQuality 99
- var minQuality 70
- #precision 0 - 99 (anything over 99 will be an unreachable target = wasted moves)
- # - You generally want this to be just as high as the capacity on your item,
- # higher is a waste unless averaging other sigils to reach that target
- # - Low precision = low hardness + high workability.
- # High precision = high hardness + low workability
- # Storebought sigils are 20 precision
- # if working with store-bought totems, you only need a capacity of 40.
- # Use threshhold of 10 if working with store bought totems and another storebought sigil.
- # Use threshhold of 1 if working with store bought totems and two storebought sigils (why though?)
- var maxPrecision 70
- var minPrecision 51
- ################################### General Information ###########################
- # Quality is the key stat for workorders
- # Precision is the key stat for potency or effectiveness, and it makes it harder to craft
- # Best workorder sigil = very high quality, low precision
- ################################### ACTION DEFINITION ###########################
- #out of 0-100
- action var qualityLevel $1 when Clarity:(\d+)
- action var precisionLevel $1 when Precision:(\d+)
- #0-20
- action eval sanityLevel count("$1","*") when Sanity: (\**)
- action eval resolveLevel count("$1","*") when Resolve: (\**)
- action eval focusLevel count("$1","*") when Focus: (\**)
- action eval dangerLevel count("$1","*") when Danger: (\**)
- #$1 = diffuclty (trivial -> straightforward -> challenging -> formidable -> difficult)
- #$2 = cost variable (resolve, sanity, focus)
- #$3 = [DROPPING - DOES NOTHING] cost amount (taxing -> disrupting -> destroying)
- #$4 = command [GUID - Unique key] (TECHNIQUE, FORM, APPROACH, ACTION, METHOD, PROCESS, RITUAL)
- #$5 = Amount improved (improving, enhancing, recovering, elevate)
- #$6 = Benefit (precision, quality, focus, sanity, resolve)
- action var Improve.Sigil.Action.$4 $1|$2|0|$4|$5|$6 when \.\.\.a (\w+), (\w+) (\w+) (\w+) [to|for]* (\w+) the sigil (\w+)
- action var Improve.Sigil.Action.$4 $1|$2|0|$4|$5|$6 when \.\.\.a (\w+), (\w+) (\w+) (\w+) [to|for]* (\w+) your (\w+)
- #abort early
- action goto Improve.Sigil.EMPTY when You are unaware of any completely identified sigils in the area
- action goto Improve.Sigil.BLEWIT when You lose track of your surroundings
- action goto Improve.Sigil.TIMEOUT when You are unaware of any sigils in the area. First identify one before attempting to improve its detail.
- 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\.
- ################################## MAIN FUNCTIONS ############################
- Improve.Sigil.Main.Start:
- gosub Improve.Sigil.InitVars
- Improve.Sigil.Main.Loop:
- gosub Improve.Sigil.CheckDanger
- gosub Improve.Sigil.SetActionVars
- gosub Improve.Sigil.ConvertActionVars
- gosub Improve.Sigil.FindBestAction
- pause .05
- goto Improve.Sigil.Main.Loop
- Improve.Sigil.SetActionVars:
- pause .05
- gosub Improve.Sigil.CleanActions
- #find the options
- COUNTER ADD 1
- put %Improve.Sigil.nextAction
- waitfor Roundtime
- pause $roundtime
- return
- Improve.Sigil.FindBestAction:
- #trivial = 1, straightforward = 2, challenging = 3, formidable = 4, difficult = 5
- # originally did a pass on each difficulty, changed to numeric subs to do this with one pass.
- gosub Improve.Sigil.find.Generic 1
- return
- Improve.Sigil.find.Generic:
- pause .05
- var Improve.Sigil.find.Generic.difficulty $1
- ######### IMPORTANT #########
- # THIS IS NOT OPTIMIZED #
- # THIS NEEDS TO BE IMPROVED #
- #############################
- var Improve.Sigil.nextAction per sigil improve
- var Improve.Sigil.find.Generic.best NULL
- var Improve.Sigil.find.Generic.difficulty 100
- var Improve.Sigil.find.Generic.cost 100
- if ((%qualityLevel >= %maxQuality) && (%precisionLevel >= %maxPrecision)) then {
- put #echo yellow Quality and Precision at or above threshhold levels
- put #echo yellow ... Quality = %qualityLevel with a target >= %maxQuality
- put #echo yellow ... Precision = %precisionLevel with a target >= %maxPrecision
- goto Improve.Sigil.END
- }
- if (%precisionLevel < %maxPrecision) then {
- gosub Improve.Sigil.find.Generic.TestVar ACTION precision
- gosub Improve.Sigil.find.Generic.TestVar APPROACH precision
- gosub Improve.Sigil.find.Generic.TestVar EFFORT precision
- gosub Improve.Sigil.find.Generic.TestVar FORM precision
- gosub Improve.Sigil.find.Generic.TestVar METHOD precision
- gosub Improve.Sigil.find.Generic.TestVar PROCESS precision
- gosub Improve.Sigil.find.Generic.TestVar RITUAL precision
- gosub Improve.Sigil.find.Generic.TestVar TASK precision
- gosub Improve.Sigil.find.Generic.TestVar TECHNIQUE precision
- } else {
- put #echo skipping precision - at or above target
- put #echo blue ... Precision = %precisionLevel with a target >= %maxPrecision
- }
- if (("%Improve.Sigil.find.Generic.best" = "NULL") && (%qualityLevel < %maxQuality)) then {
- gosub Improve.Sigil.find.Generic.TestVar ACTION quality
- gosub Improve.Sigil.find.Generic.TestVar APPROACH quality
- gosub Improve.Sigil.find.Generic.TestVar EFFORT quality
- gosub Improve.Sigil.find.Generic.TestVar FORM quality
- gosub Improve.Sigil.find.Generic.TestVar METHOD quality
- gosub Improve.Sigil.find.Generic.TestVar PROCESS quality
- gosub Improve.Sigil.find.Generic.TestVar RITUAL quality
- gosub Improve.Sigil.find.Generic.TestVar TASK quality
- gosub Improve.Sigil.find.Generic.TestVar TECHNIQUE quality
- } else {
- put #echo skipping Quality - working on precision or at or above target
- put #echo blue ... Quality = %qualityLevel with a target >= %maxQuality
- }
- goto Improve.Sigil.find.Generic.Return
- #$1 = diffuclty (trivial -> straightforward -> challenging -> formidable -> difficult)
- #$2 = cost variable (resolve, sanity, focus)
- #$3 = [hard coded 0 - does nothing] cost amount (taxing -> disrupting -> destroying)
- #$4 = command [GUID - Unique key] (TECHNIQUE, FORM, APPROACH, ACTION, METHOD, PROCESS, RITUAL)
- #$5 = unclear if this does anything - Amount improved (improving, enhancing, recovering, elevate)
- #$6 = Benefit (precision, quality, focus, sanity, resolve)
- #array values
- #difficulty |cost bucket| N/A1 | command | N/A2 | reward bucket
- # N/A1 = ignore - just text [old: cost]
- # N/A2 = ignore - just text [old: reward amount]
- #ie: trivial|focus|disrupting|METHOD|recovering|resolve
- Improve.Sigil.find.Generic.TestVar:
- if (%verboseDebug = 1) then put #echo blue processing
- pause .05
- var Improve.Sigil.TestVar.element $1
- var Improve.Sigil.find.Generic.TestVar.keyValue $2
- #confirm this is an action
- if ("%Improve.Sigil.Action.%Improve.Sigil.TestVar.element" = "NULL") then return
- #clean the text
- var Improve.Sigil.ConvertActionVars.node Improve.Sigil.Action.%Improve.Sigil.TestVar.element
- gosub Improve.Sigil.ConvertActionVars Improve.Sigil.Action.%Improve.Sigil.TestVar.element
- #store for easy access
- var Improve.Sigil.find.Generic.TestVar.array %Improve.Sigil.Action.%Improve.Sigil.TestVar.element
- #check for key value on test node, currently only testing for precision or quality
- if ("%Improve.Sigil.find.Generic.TestVar.array(5)" = "%Improve.Sigil.find.Generic.TestVar.keyValue") then {
- if (%verboseDebug = 1) then put #echo green found a %Improve.Sigil.find.Generic.TestVar.keyValue node with action %Improve.Sigil.TestVar.element
- #check cost slot 1 = bucket, slot 2 = amount
- 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)
- #create a cost variable based on difficulty
- # Trivial = 1 to 3 est=2 success = 1-2, chaotic break = 3
- # Straightforward = 2 to 4 est=3 success = 2-3, chaotic break = 4
- # challenging = 4 to 5 est=4 success = 4-5, chaotic break = 4
- # formidable = 4 to 5 est=6 success = 4, chaotic break = _, fail = 3
- # difficult = 7 to 9 est=8 success = 8-9, chaotic break = _, fail = 7
- var TMP.sigil.poolCost.max %Improve.Sigil.find.Generic.TestVar.array(0)
- ## NEW Feature if low danger, take bigger risks.
- if (%dangerLevel < 5 && %precisionLevel < %minPrecision && %qualityLevel < %minQuality) then {
- math TMP.sigil.poolCost.max subtract 1
- }
- if (%%Improve.Sigil.find.Generic.TestVar.array(1)Level >= %TMP.sigil.poolCost.max) then {
- # how many points are in the bucket (sanity, resolve, focus) and how much does the move cost?
- 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)
- if (%verboseDebug = 1) then put #echo green .........have enough resources, checking if it's less cost than stored element
- if (%verboseDebug = 1) then put #echo purple .........(debug: stored cost = %Improve.Sigil.find.Generic.cost)
- if (%verboseDebug = 1) then put #echo purple .........(debug: test cost = %Improve.Sigil.find.Generic.TestVar.array(0))
- # check if tested element is cheaper than stored element.
- if (%Improve.Sigil.find.Generic.TestVar.array(0) < %Improve.Sigil.find.Generic.cost) then {
- 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)
- gosub Improve.Sigil.find.Generic.TestVar.RegisterNewBestAction
- } else {
- # if not cheaper, is it equal cost?
- 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)
- # equal resource cost, test difficulty
- if (%Improve.Sigil.find.Generic.TestVar.array(2) = %Improve.Sigil.find.Generic.cost) then {
- #if equal cost, is it easier?
- 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)
- if (%Improve.Sigil.find.Generic.TestVar.array(0) < %Improve.Sigil.find.Generic.difficulty) then {
- gosub Improve.Sigil.find.Generic.TestVar.RegisterNewBestAction
- } else {
- if (%verboseDebug = 1) then put #echo yellow skipping - cost equal, but not easier
- }
- } else {
- if (%verboseDebug = 1) then put #echo yellow skipping - cost higher than existing option
- }
- }
- } else {
- 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)
- if (%verboseDebug = 1) then put #echo yellow skipping - not enough resources to pull off
- }
- } else {
- #end result != target
- }
- return
- Improve.Sigil.find.Generic.TestVar.RegisterNewBestAction:
- pause .05
- if (%verboseDebug = 1) then {
- put #echo purple .........-----replacing value---------
- put #echo purple .........(old: %Improve.Sigil.find.Generic.best / new: %Improve.Sigil.TestVar.element)
- put #echo purple .........(old: %Improve.Sigil.find.Generic.best / new: %Improve.Sigil.TestVar.element)
- put #echo purple .........(old difficulty: %Improve.Sigil.find.Generic.difficulty / new: %Improve.Sigil.find.Generic.TestVar.array(0))
- put #echo purple .........(old action: %Improve.Sigil.nextAction / new action %Improve.Sigil.find.Generic.best
- }
- var Improve.Sigil.find.Generic.best %Improve.Sigil.TestVar.element
- var Improve.Sigil.find.Generic.difficulty %Improve.Sigil.find.Generic.TestVar.array(0)
- var Improve.Sigil.find.Generic.cost %Improve.Sigil.find.Generic.TestVar.array(0)
- var Improve.Sigil.nextAction per sigil %Improve.Sigil.find.Generic.best
- put #echo blue .... New best action %Improve.Sigil.nextAction
- return
- Improve.Sigil.find.Generic.Return:
- return
- Improve.Sigil.CheckDanger:
- if ((%dangerLevel >= %dangerThreshold) && (%qualityLevel>=%minQuality) && (%precisionLevel>= %minPrecision)) then {
- put #echo >Log green danger too high (%dangerLevel / %dangerThreshold), harvesting (p: %precisionLevel, q: %qualityLevel)
- goto Improve.Sigil.END
- } else {
- put #echo green Keep going d:%dangerLevel (of %dangerThreshold), q: %qualityLevel (min:%minQuality max: %maxQuality), p: %precisionLevel (min: %minPrecision, max: %maxPrecision )
- }
- #if (%qualityLevel > 0 and %qualityLevel < %maxQuality) then {
- # put #echo quality too low, harvesting
- # goto Improve.Sigil.END
- # ########## IMPORTANT ##########
- # # THIS IS NOT OPTIMIZED #
- # # Script should fix quality #
- # ###############################
- #
- #}
- return
- #converts the text to numeric values for easy comparison
- Improve.Sigil.ConvertActionVars:
- ########## IMPORTANT ##########
- # THIS IS NOT OPTIMIZED #
- # THIS NEEDS TO BE IMPROVED #
- # Potentially combine replaces#
- ###############################
- pause .05
- var Improve.Sigil.ConvertActionVars.name $1
- ## Set to > 100 to turn off this difficulty
- #difficulty
- eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "trivial", "2")
- eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "straightforward", "3")
- eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "challenging", "4")
- eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "formidable", "6")
- eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "difficult", "8")
- # eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "difficult", "105")
- #cost
- #eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "disrupting", "3")
- #eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "taxing", "4")
- #eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "destroying", "8")
- #cost
- eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "improving", "1")
- eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "enhancing", "2")
- eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "recovering", "3")
- eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "elevate", "4")
- return
- ########################## ERROR AND EXIT FUNCTIONS ######################
- Improve.Sigil.TIMEOUT:
- put #echo red >Log Script hung. Exiting
- goto Improve.Sigil.END
- Improve.Sigil.BLEWIT:
- put #echo red >Log Sigil FAIL (%1) Steps:%c, Q:%qualityLevel, P:%precisionLevel
- goto Improve.Sigil.END
- Improve.Sigil.EMPTY:
- put #echo >SigilLog room empty, shorting out of sigil improve early.
- goto Improve.Sigil.END
- Improve.Sigil.END:
- put #echo >sigillog Improve Finish (%1): Steps:%c, Q:%qualityLevel, P:%precisionLevel
- put #parse IMPROVE SIGIL FINISHED
- exit
- ################ CLEAN ACTIONS ####################
- Improve.Sigil.InitVars:
- pause .05
- put #echo blue zeroing out sigil levels
- var dangerLevel 0
- var sanityLevel 0
- var resolveLevel 0
- var focusLevel 0
- var qualityLevel 0
- var precisionLevel 0
- var Improve.Sigil.nextAction per sigil improve
- var sigilName NULL
- COUNTER set 0
- return
- Improve.Sigil.CleanActions:
- ############ IMPORTANT ############
- # THIS IS POORLY IMPLEMENTED #
- # Replace with a new array, #
- # 2 separating characters #
- # one for inner, one outer #
- ###################################
- var Improve.Sigil.Action.ACTION NULL
- var Improve.Sigil.Action.APPROACH NULL
- var Improve.Sigil.Action.EFFORT NULL
- var Improve.Sigil.Action.FORM NULL
- var Improve.Sigil.Action.METHOD NULL
- var Improve.Sigil.Action.PROCESS NULL
- var Improve.Sigil.Action.RITUAL NULL
- var Improve.Sigil.Action.TASK NULL
- var Improve.Sigil.Action.TECHNIQUE NULL
- var Improve.Sigil.NextBestAction NULL
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement