Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
zilch
Newbie


Joined: 07 Feb 2020
Posts: 8

PostPosted: 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
  }
}
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net