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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Aleron
Wanderer


Joined: 01 Aug 2005
Posts: 76

PostPosted: Sat Dec 20, 2008 12:34 am   

[2.37] Odd (ie, buggy) behavior with #STEP and paths
 
I'm experiencing some buggy behavior with #STEP and paths in CMUD. As of recently, when I'm using a particular set of triggers for pathing around an area in the mud, #STEP will sometimes send the entire portion of the current path that remains, rather than only the next single direction. The following quote is output from one such occurrence.

Quote:
<772hp 690e 121359425exp 123mv [] NS>dir memory: south|east|east
flee dirs:
debug - before #STEP
2s2wdsds
debug - after #STEP
debug - exiting engine alias
<Type 'help' for help>

<772hp 690e 121359425exp 123mv [] NS>Slow walking aborted


The code below is the alias that is executed in each room which controls everything, including the execution of #STEP.

Code:
#LOCAL $lastDir
#SAY debug - entering engine alias
#WAIT 500
#SAY dir memory: @dirMemory
#SAY flee dirs: @fleeDirs
#IF (@hasFled = "false") {
  #IF (%numitems(@mobsInRoom) > 0) {
    k %item(@mobsInRoom, 1)
    doFocus
    #VAR inBattle "true"
  } {
    #IF (@hitPoints <= @botHPThreshold) {
      // Fake a flee. This will cause memory
      // to backtrack and then sleep, where
      // I should be safe.
      #VAR hasFled "true"
      #VAR inBattle "false"
      engine
    } {
      #IF (@room != "coin") {
        // If there are movements still left in the
        // fleeDirs variable then do those first,
        // THEN continue STEP'ing on the path
        #IF (%numitems(@fleeDirs) > 0) {
          $lastDir = %pop(@fleeDirs)
          #SWITCH ($lastDir = "north") {n}
              ($lastDir = "south") {s}
              ($lastDir = "east") {e}
              ($lastDir = "west") {w}
              ($lastDir = "up") {u}
              ($lastDir = "down") {d}
        } {
          #SAY debug - before #STEP
          #STEP
          #SAY debug - after #STEP
        }
      }
    }
  }
} {
  #IF (%numitems(@dirMemory) > 0) {
    $lastDir = %pop(@dirMemory)
    #VAR fleeDirs %push($lastDir, @fleeDirs)
    #SWITCH ($lastDir = "north") {s}
            ($lastDir = "south") {n}
            ($lastDir = "east") {w}
            ($lastDir = "west") {e}
            ($lastDir = "up") {d}
            ($lastDir = "down") {u}
  } {
    #IF (@hitPoints <= @botHPThreshold) {
      gt ~[BOT~] HP is too low. Resting...
      #VAR botIsSleeping "true"
      eatf
      drinkw
      #WAIT 2000
      sleeph
    } {
      #VAR hasFled "false"
      engine
    }
  }
}
#SAY debug - exiting engine alias


For a good week or two, this set of triggers was causing me no problem. Whether it's some corruption of the package file or something, I have no idea. I did force the alias to recompile as a sanity check, and I still see this behavior. I cannot reproduce it in a controlled way, it just happens. Sometimes after a few minutes of the triggers running, sometimes after hours, sometimes not at all.

Anything I can send in that would help diagnosing this bug?

Edit:

When #STEP fails like this, if I execute it (#STEP) again, it goes back to working normally.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion 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