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
- #echo yellow --- USE AT YOUR OWN RISK: Alpha Version, Disruption numbers are off - much room for improvement ---
- debug 0
- var verboseDebug 0
- #Variables to edit
- # danger threshould out of 20
- var dangerThreshold 4
- #quality 0 - 100
- var qualityThreshold 30
- ################################### 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 = 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|$3|$4|$5|$6 when \.\.\.a (\w+), (\w+) (\w+) (\w+) [to|for]* (\w+) the sigil (\w+)
- action var Improve.Sigil.Action.$4 $1|$2|$3|$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.TIMEOUT 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 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
- 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
- if ("%Improve.Sigil.find.Generic.best" = "NULL" && %qualityLevel < 85) 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
- }
- goto Improve.Sigil.find.Generic.Return
- #$1 = diffuclty (trivial -> straightforward -> challenging -> formidable -> difficult)
- #$2 = cost variable (resolve, sanity, focus)
- #$3 = 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)
- #array values
- #difficulty |cost bucket| cost | command | reward amount | reward bucket
- #ie: trivial|focus|disrupting|METHOD|recovering|resolve
- Improve.Sigil.find.Generic.TestVar:
- 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(2)
- if (%%Improve.Sigil.find.Generic.TestVar.array(1)Level >= %Improve.Sigil.find.Generic.TestVar.array(2)) 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(2)
- 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(2))
- # check if tested element is cheaper than stored element.
- if (%Improve.Sigil.find.Generic.TestVar.array(2) < %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(2)) < (%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(2)
- 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(2)
- 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 then {
- put #echo green danger too high, harvesting
- goto Improve.Sigil.END
- }
- #if (%qualityLevel > 0 and %qualityLevel < %qualityThreshold) 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
- #difficulty
- eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "trivial", "1")
- eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "straightforward", "2")
- eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "challenging", "3")
- eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "formidable", "4")
- eval %Improve.Sigil.ConvertActionVars.name replace("%%Improve.Sigil.ConvertActionVars.name", "difficult", "5")
- #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 You blew up a sigil.
- 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: 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