My Help/Bug Thread

Post Reply
Sahmiam
Posts: 6
Joined: Sun Dec 27, 2009 8:12 am

My Help/Bug Thread

Post by Sahmiam »

As I'll probably be requesting it from time to time, I decided to just make my own thread.

Anyway, I may have stumbled upon a bug, or I'm simply staring at an overly obvious problem. I've tried with both tonumber() (which I will be using, I was just testing without) and the player.x variables are initialized and work in other code. Anyway, here's the code:

Code: Select all

--	Capture player's stats from score

--	First Line
player.health = multimatches[1][2]
player.healthMax = multimatches[1][3]
player.endurance = multimatches[1][4]
player.enduranceMax = multimatches[1][5]
player.reserves = multimatches[1][6]

--	Second Line
player.mana = multimatches[2][2]
player.manaMax = multimatches[2][3]
status.willpower = multimatches[2][4]
player.willpowerMax = multimatches[2][5]
player.power = multimatches[2][6]

--	Third Line
player.ego = multimatches[3][2]
player.egoMax = multimatches[3][3]
player.mindset = multimatches[3][4]
player.esteem = multimatches[3][5]
This is captured from a multiline AND trigger that fires 3x for 3 lines with the following regex(which needs to be cleaned a bit)

Code: Select all

^\|\s+Health\s+:\s+(\d+)/(\d+)\s+Endurance\s+:\s+(\d+)/(\d+)\s+Power\s+:\s+(\d+)p\s+\|$
^\|\s+Mana\s+:\s+(\d+)/(\d+)\s+Willpower\s+:\s+(\d+)/(\d+)\s+Reserves\s+:\s+(\d+)%\s+\|$
^\|\s+Ego\s+: (\d+)/(\d+)\s+Mindset\s+:\s+(\w+)\s+Esteem\s+:\s+(\d+)%\s+\|$

This results in the following output from the debug window:

Code: Select all

name=Score(^\|\s+Health\s+:\s+(\d+)/(\d+)\s+Endurance\s+:\s+(\d+)/(\d+)\s+Power\s+:\s+(\d+)p\s+\|$) 
matched.
capture group #1 = <| Health : 5625/5625     Endurance : 20180/20180     Power    : 10p       |>
capture group #2 = <5625>
capture group #3 = <5625>
capture group #4 = <20180>
capture group #5 = <20180>
capture group #6 = <10>
match state 1/1 condition #0=true (0/3) 
regex=^\|\s+Health\s+:\s+(\d+)/(\d+)\s+Endurance\s+:\s+(\d+)/(\d+)\s+Power\s+:\s+(\d+)p\s+\|$
new line arrived:| Mana   : 6321/5659     Willpower : 21560/21560     Reserves : 100%      |

Trigger 
name=Score(^\|\s+Mana\s+:\s+(\d+)/(\d+)\s+Willpower\s+:\s+(\d+)/(\d+)\s+Reserves\s+:\s+(\d+)%\s+\|$) 
matched.
capture group #1 = <| Mana   : 6321/5659     Willpower : 21560/21560     Reserves : 100%      |>
capture group #2 = <6321>
capture group #3 = <5659>
capture group #4 = <21560>
capture group #5 = <21560>
capture group #6 = <100>
match state 1/1 condition #1=true (1/3) 
regex=^\|\s+Mana\s+:\s+(\d+)/(\d+)\s+Willpower\s+:\s+(\d+)/(\d+)\s+Reserves\s+:\s+(\d+)%\s+\|$
new line arrived:| Ego    : 5659/5659     Mindset   : Pedantic        Esteem   : 0%        |

Trigger name=Score(^\|\s+Ego\s+: (\d+)/(\d+)\s+Mindset\s+:\s+(\w+)\s+Esteem\s+:\s+(\d+)%\s+\|$) 
matched.
capture group #1 = <| Ego    : 5659/5659     Mindset   : Pedantic        Esteem   : 0%        |>
capture group #2 = <5659>
capture group #3 = <5659>
capture group #4 = <Pedantic>
capture group #5 = <0>
match state 1/1 condition #2=true (2/3) regex=^\|\s+Ego\s+: 
(\d+)/(\d+)\s+Mindset\s+:\s+(\w+)\s+Esteem\s+:\s+(\d+)%\s+\|$
multiline trigger name=Score *FIRES* all conditons are fullfilled. Executing script.
LUA OK script Score (Trigger387) ran without errors
removing condition from conditon table.
new line arrived:|------------------------------------------------------------------- KARMA|

LUA: ERROR running script Score (Trigger387) ERROR:Lua error:[string "function Trigger387()..."]:5: 
attempt to index field '?' (a nil value)
new line arrived:| Karma  : 18%                                                            |

LUA: ERROR running script Score (Trigger387) ERROR:Lua error:[string "function Trigger387()..."]:5: 
attempt to index field '?' (a nil value)
new line arrived:| The karmic blessing of life      : 3 hours 21 minutes                   |

LUA: ERROR running script Score (Trigger387) ERROR:Lua error:[string "function Trigger387()..."]:5: 
attempt to index field '?' (a nil value)
new line arrived:|---------------------------------------------------------------- RANKINGS|


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

Re: My Help/Bug Thread

Post by Heiko »

Can you do a display( multimatches ) as first line in the trigger script plz and post the output.

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

Re: My Help/Bug Thread

Post by Heiko »

Please post a screenshot of your trigger. Have you set firelength > 0?

Sahmiam
Posts: 6
Joined: Sun Dec 27, 2009 8:12 am

Re: My Help/Bug Thread

Post by Sahmiam »

Output from the display(multimatches)

Code: Select all

table {
  1: table {
    1: '| Health : 5004/4700     Endurance : 18800/18800     Power    : 10p       |'
    2: '5004'
    3: '4700'
    4: '18800'
    5: '18800'
    6: '10'
  }
  2: table {
    1: '| Mana   : 4636/4716     Willpower : 21560/21560     Reserves : 88%       |'
    2: '4636'
    3: '4716'
    4: '21560'
    5: '21560'
    6: '88'
  }
  3: table {
    1: '| Ego    : 4440/4440     Mindset   : Pedantic        Esteem   : 5%        |'
    2: '4440'
    3: '4440'
    4: 'Pedantic'
    5: '5'
  }
}

Screenshot of the trigger.
Attachments
Capture.PNG

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

Re: My Help/Bug Thread

Post by Heiko »

It's not a bug. You have set firelength = 3. Consequently, your trigger will fire on the 3 subsequent lines after it has matched for the first time. If you dont want this (most likely :) ) set firelength to 0.

Post Reply