Barut Posted November 12, 2010 Share Posted November 12, 2010 I have almost finished my addon but when I tried to add bars to display health of enemies my addon stopped working correctly. Can someone please help me? EDITED: I'm done with my addon thanx for helping Quote Link to comment Share on other sites More sharing options...
Ciuine Posted November 12, 2010 Share Posted November 12, 2010 Your code breaker is the first pass which results in; Code: wtBars :Show(false) Seems like a database error attributed to changing a widget into a number by means of; Code: wtBars = unitId I might be horribly wrong, but that's what I can see just by glancing at the code. Quote Link to comment Share on other sites More sharing options...
Guest Carnifex Posted November 12, 2010 Share Posted November 12, 2010 yes, wtBars = unitId is completly nonsence BTW: how to understand error messages Quote: Error: addon Sniper: Error while running the chunk Error: addon Sniper: [string "mods/addons/sniper/scripts/sniper.lua"] : 146 : attempt to index field `?' (a number value) Error: addon Sniper: func: ?, ?, line: -1, defined: C, line: -1, [c] Error: addon Sniper: func: CreatePlayerList, global, line: 146, defined: Lua, line: 131, [string "mods/addons/sniper/scripts/sniper.lua"] Error: addon Sniper: func: TrackEnvironment, global, line: 119, defined: Lua, line: 52, [string "mods/addons/sniper/scripts/sniper.lua"] -the bold part is the important part (the other part say only from the bottom to the top, which function has calles the function in which the error is found) -the underlined part is the line number of the error: in your case it is 146 "wtBars :Show(false) end" -the red part is the important part of the erroe msg, because it says you, what the error has caused: in your case the fact, that wtBars is a number value (because of the line 142 as you find by looking for a reason for it) and that it is impossible to call :Show(false) from a number Quote Link to comment Share on other sites More sharing options...
Setras Posted November 12, 2010 Share Posted November 12, 2010 Well, man, i've watched through your code and noticed totally useless strings: if unitHPP < 60 then unitKiller = unitHPP * 10 elseif unitHPP < 30 then unitKiller = unitHPP * 30 elseif unitClass.className == "PRIEST" and unitHPP < 60 then unitKiller = unitHPP * 20 elseif unitClass.className == "PRIEST" and unitHPP < 30 then unitKiller = unitHPP * 40 elseif unitClass.className == "NECROMANCER" and unitHPP < 60 then unitKiller = unitHPP * 15 elseif unitClass.className == "NECROMANCER" and unitHPP < 30 then unitKiller = unitHPP * 35 end As far as i know this is executed next way: if unitHPP < 60 then unitKiller = unitHPP * 10 elseif , e.g. if unitHPP is NOT < 60 and if unitHPP < 30 (Which is totally absurd, it can't be NOT LESS than 60 but LESS than 30) then unitKiller = unitHPP * 30 elseif unitClass.className == "PRIEST" and unitHPP < 60 then (Same, it can't be true if upper thing is false coz 1-st statement is false only if unitHPP is 60 or more) Well, same for the rest of that part of the code. I didn't inspect the whole code, it was just first sight. BTW, Do you speak russian, or you just correct google using your native sense of slavik speech? Quote Link to comment Share on other sites More sharing options...
Guest Hommit Posted November 12, 2010 Share Posted November 12, 2010 Quote: unitClass.className == "PRIEST" and unitHPP < 60 i don't know about priorities in lua, but this coulb be very well like this:elseif unitClass.className == ("PRIEST" and unitHPP) < 60 then ... Quote Link to comment Share on other sites More sharing options...
Setras Posted November 13, 2010 Share Posted November 13, 2010 I don't think so. But i always use ( ) so... IDK. Quote Link to comment Share on other sites More sharing options...
Barut Posted November 13, 2010 Author Share Posted November 13, 2010 @Setras I'm Serbian so I use my native sense of slavik to correct google translator Does anyone know why ("class", "tip_orange") doesn't display proper color, are there certain colors that are allowed to be used for tip tag? P.S. I edited the code now it's more optimized as it uses less elseif's which makes it run faster. Quote Link to comment Share on other sites More sharing options...
Setras Posted November 13, 2010 Share Posted November 13, 2010 Sure. Red(not sure really), Green, Blue, Purple, Orange, White, well one for each equipment colour(before 2.x). Ah, also grey i think. THey also had aliases in ancient scripts (the uncompiled ones) like "Junk" for grey (but not tip_junk afaik) and "Epic" for violet and so on... Well, violet or purple, i don't really remember them. P.S. Roses are red Violets are blue So what the f*ck is the colour "violet"? Quote Link to comment Share on other sites More sharing options...
Setras Posted November 13, 2010 Share Posted November 13, 2010 Well well well, STOP! There really should be one fopr ORANGE! K, just search through old scripts for all this stuff. I'll do it in a minute or two. Quote Link to comment Share on other sites More sharing options...
Setras Posted November 13, 2010 Share Posted November 13, 2010 class = "tip_white" class = "tip_green" style = "tip_golden" - this is for orange i believe style = "tip_blue" Well there should be one for violet, again. Quote Link to comment Share on other sites More sharing options...
Guest Carnifex Posted November 13, 2010 Share Posted November 13, 2010 tip_grey tip_red Quote Link to comment Share on other sites More sharing options...
Recommended Posts