zilch Newbie
Joined: 07 Feb 2020 Posts: 8
|
Posted: Thu Jan 26, 2023 10:18 pm
Scripting Question - Gauges |
Setting up an affects bar and having some issues. The code works fine, but when the gauges are refreshed there is a 1/4 second freeze. Is this from UI refreshing gauges or something in my code?? Any suggestions appreciated!
Code: |
#LOCAL $newAffects
// Format newAffects string list from data recieved from mud
$new_data = %replace(%replace(%1, %char(7)%char(7) , "|"), %char(7), "")
// Compile a database record of formated newAffects
#FORALL ($new_data) {
$affect_data = %replace(%i, "," , " ")
$rounds = %word($affect_data, %numwords($affect_data))
$affect_data = %remove($rounds, $affect_data)
$affect = %replace(%trim($affect_data), " ", "_")
#ADDKEY $newAffects $affect $rounds
// If its a new affect add it to @affects
#IF (!%iskey(@affects, $affect)) {
#ADDKEY affects $affect $rounds
}
// If we dont have a gauge for this spell then create one
#IF (%class(btn_affect_$affect) < 0) {
#BUTTON btn_affect_$affect %concat(%replace(%proper($affect), "_", " "), " (@affects.", $affect, ")") {} {} {} {@affects.$affect} {} {} {Size} {144} {23} {} {1} {1} {} {} {Gauge|Lime|red|1350|100} {-19} {Bar_Affects} {Explore|Inset} {} {} {3}
} { // If we have a gauge and its off, toggle it on
#IF (!%trigger(btn_affect_$affect)) {#T+ btn_affect_$affect}
}
}
// Loop through affects to remove expired spells and update existing ones
#LOOPDB (@affects) {
//If its not in the newAffects remove it and turn the gauge off
#IF (!%iskey($newAffects, %key)) {
#T- btn_affect_%key
#DELKEY affects %key
} {
affects.%key = $newAffects.%key
}
}
|
|
|