Mantis Bug Squashing Help

User avatar
Jules
Posts: 118
Joined: Sun Oct 11, 2009 5:41 pm
Location: Plymouth State University - Sophomore

Mantis Bug Squashing Help

Post by Jules »

I got this bug from Sheia, and for whatever reason, I cannot find a solution to the problem. Her problem stems from reading the diagnose line of being anorexic, which is:
anorexic.
The trigger is picked up by the system, but the proper curing alias isn't run. Here are some screenshots, taken by Sheia.

http://i991.photobucket.com/albums/af40 ... apture.png
http://i991.photobucket.com/albums/af40 ... apture.png
http://i991.photobucket.com/albums/af40 ... pture1.png
http://i991.photobucket.com/albums/af40 ... pture2.png
http://i991.photobucket.com/albums/af40 ... pture3.png
http://i991.photobucket.com/albums/af40 ... apture.png

User avatar
Heiko
Site Admin
Posts: 1548
Joined: Wed Mar 11, 2009 6:26 pm

Re: Mantis Bug Squashing Help

Post by Heiko »

Your trigger pattern #3 is most likely wrong. Pattern type exact match means that this trigger will only fire if the entire line reads exactly like your trigger pattern #3. If there's some more letters, the trigger will not fire. If you chose this pattern type, then you need to copy the entire line and make it a pattern.

goose
Posts: 13
Joined: Sun Jun 14, 2009 2:51 pm

Re: Mantis Bug Squashing Help

Post by goose »

Try changing "anorexia" to "anorexic" in the Pipe Queue script.

User avatar
Jules
Posts: 118
Joined: Sun Oct 11, 2009 5:41 pm
Location: Plymouth State University - Sophomore

Re: Mantis Bug Squashing Help

Post by Jules »

@Heiko I'll have to try out changing it, I guess. The script wasn't even being picked up by the system, so I guess it wasn't the right pattern. I'll change this.

@goose I noticed that too, right before I posted here, and I passed that along. She said that it still didn't work... :cry:

Iocun
Posts: 174
Joined: Wed Dec 02, 2009 1:45 am

Re: Mantis Bug Squashing Help

Post by Iocun »

Hmm, if this is the only affliction that doesn't work, I would have been fairly sure that the problem goose mentioned was the one that caused it. Maybe you have "anorexia" instead of "anorexic" somewhere else?

The debug console did show that the trigger was matched, so I'd think the pattern isn't the problem. Plus, knowing that this diagnose line litterally is just "anorexic." without any other words in front of it, I see no reason why it shouldn't match.

Personally, I'd add some temporary echoes in all the functions/aliases that should be called at some point. Then you'll know where it stops working. I also have an alias that evaluates any Lua expression and echoes the result, which is very useful for bugfixing. I.e. you could use it to see whether pipeQueue["anorexic"] is properly set to true after the trigger matches or not.

P.S. said alias is a variation of the "run lua code from the command line" posted on this forum. It simply does:
assert(loadstring("echo(" .. matches[2] .. ")"))()

User avatar
Jules
Posts: 118
Joined: Sun Oct 11, 2009 5:41 pm
Location: Plymouth State University - Sophomore

Re: Mantis Bug Squashing Help

Post by Jules »

I will definitely be sure to implement that as soon as possible! That sounds very useful! Thank you!

User avatar
Heiko
Site Admin
Posts: 1548
Joined: Wed Mar 11, 2009 6:26 pm

Re: Mantis Bug Squashing Help

Post by Heiko »

Looked at your trigger again. It does seem to fire correctly, but you add the wrong affliction in the trigger, namely anorexic instead of anorexia.

User avatar
Jules
Posts: 118
Joined: Sun Oct 11, 2009 5:41 pm
Location: Plymouth State University - Sophomore

Re: Mantis Bug Squashing Help

Post by Jules »

Necro'ing this thread to post up a new problem that I'm having.

With extensive help from Oneymus, I've been squishing some bugs that I've been having with the latest iteration of Mantis Beta Release 5.0. Currently, for debugging purposes, I have all of my actions echo'd back to me so I know exactly what's going on at any given time when I have an affliction in the queue. I'll post up all of the scripts that I have here, in the order that they would be fired.

Firstly, an incoming affliction is added to a list called "mantisAfflictedWith", which I shall from now on refer to as the "affliction queue".

Code: Select all

function MantisAddAffliction(affliction)
  if not mantisAfflictedWith[affliction] then
    table.insert(mantisAfflictedWith, affliction)
  end
end
Next, prompted on each incoming prompt, the curing script is run. Please note, the script here has all of the echo's put in, to better understand what's firing correctly, and what isn't.

Code: Select all

function MantisCureAfflictions()
  for _,affliction in ipairs(mantisAfflictedWith) do
  echo( "Affliction: " .. affliction .. "\n" )
    for _,balance in ipairs(mantisBalancePriorities) do
    echo( "Balance Type: " .. balance .. "\n" )
      if mantis.healingBalances[balance] then
      echo( "Checking balance step." .. "\n" )
        for index,cure in pairs(mantisAfflictionPriorities[balance]) do
        echo( "Cure index: " .. index .. "\n" )
          if index == affliction then
          echo( "Affliction found." .. "\n" )
            send(cure)
            mantis.healingBalances[balance] = false
            MantisResetBalance(balance)
            break
          end
        end
      end
    end
  end
end
Firstly, the code processes the affliction queue, processing all of the afflictions listed there, and remembering the actual afflictions as the variable "affliction". Next the same is done with the curing balances within the balance priorities list:

Code: Select all

mantisBalancePriorities = {"herb", "purgative", "salve", "balance", "focus",}
If the curing balance is up, iterate through that specific curing balance's cure list in mantisAfflictionPriorities (will be listed down at the very bottom). Next, send the cure, reset the balance, and finish up the cure. When the affliction is cured, the curing message is Triggered, and the affliction is removed from the queue with this script:

Code: Select all

function MantisRemoveAffliction(affliction)
  for k,v in ipairs(mantisAfflictedWith) do
    if v == affliction then
      table.remove(mantisAfflictedWith, k)
    end
  end
end
Here is the link to the affliction priorities and cure list.

Now, for my error. According to the echo's displayed back to me, the script will iterate through all of the balance lists in mantisAfflictionPriorities, but won't actually find the affliction and cure it. This is what I get:

Code: Select all

Affliction: prone
Balance Type: herb
Checking balance step.
Cure index: pairs
Balance Type: purgative
Checking balance step.
Cure index: pairs
Balance Type: salve
Checking balance step.
Cure index: pairs
Balance Type: balance
Checking balance step.
Cure index: pairs
Balance Type: focus
Checking balance step.
Cure index: pairs
Can anyone help me with this? To test out this script, I have been simply trying to cure me being "prone", by manually sitting, and then having it (hopefully) stand automatically. Thank you for all of the help!

User avatar
demonnic
Posts: 886
Joined: Sat Dec 05, 2009 3:19 pm

Re: Mantis Bug Squashing Help

Post by demonnic »

I ran into this with stygian. Declare your tables outside of the assignment.

mantisAfflictionPriorities = {}
mantisAfflictionPriorities.purgatives = phpTable()

etc.


then define what is in them. That solved it for me. I'm not sure -why- it doesn't like doing it the way you pasted above, but as soon as I declared my tables as phpTable()s and then tried to fill them, it worked fine. For some reason, all of your indices are being sent as 'pairs'

User avatar
Jules
Posts: 118
Joined: Sun Oct 11, 2009 5:41 pm
Location: Plymouth State University - Sophomore

Re: Mantis Bug Squashing Help

Post by Jules »

Is it not right that they're pairs?

Post Reply