Audio decoder crashing MUSH scripts

Posted by Starky on Mon 14 Jul 2008 08:33 PM — 7 posts, 26,844 views.

#0
Guncam and Windows media player are using an extra audio decoder called ffdshow to run certain avi files and when this process is running its somehow causing certain scripting functions to break down.

received the following run-time error while using one of Lasher's plugins


Run-time error
Plugin: Aardwolf_Stats (called from world: Aardwolf)
Function/Sub: Stat_Start called by trigger
Reason: processing trigger "Stat_Start"
[string "Plugin"]:354: bad argument #18 to 'ColourNote' (string expected, got no value
stack traceback:
        [C]: in function 'ColourNote'
        [string "Plugin"]:354: in function 'colorBar'
        [string "Plugin"]:259: in function <[string "Plugin"]:214>
Error context in script:
 350 :       blockstr = ""
 351 :     end    
 352 :   end
 353 :   table.insert(str,blockstr)
 354*:   world:ColourNote(unpack(str))
 355 : end
 356 : 
 357 : function OnPluginInstall()
 358 :   OnHelp()


then my quest tracker script was running correctly but the math.floor function was failing to execute so I was receiving like 13 decimal points instead of the usual two. Not sure what else it breaks but figured it was worthy of reporting. Once I shut down media player and guncam and closed down the decoder running process restarted MUSH it works. BUt if I restart mush with the decoder running process still going it all still fails.
Australia Forum Administrator #1
I see from your error output that you are using the older version of the stats window. I recently updated them to use the new {stats} line, see this post:

http://www.gammon.com.au/forum/?id=8783


You might want to try that first.

I can't see how using an audio decoder would make a script fail, unless it corrupted the output to the window that the stats script was attempting to decode.

As for the math.floor function - can you post the relevant part of the script, or all of it, and show in what way you know the math.floor wasn't working?

Sometimes code appear not to work - and this happens to me - when it turns out that for some strange reason it is executing something else to what you thought.

Something like this would prove it doesn't work:


a = 123.4545
print (a)   --> prints 123.4545
b = math.floor (a)
print (b)  --> prints 123


So if you put a couple of prints in temporarily to show the output, before and after the math.floor, that proves it is somehow failing to work. If you don't see the print, then the code went somewhere else.

Also see TraceOut - this lets you show information if Trace is turned on, which lets you temporarily see debugging messages:

http://www.gammon.com.au/scripts/doc.php?function=TraceOut

Netherlands #2
I could be mistaken, but aren't there special modi a program can set for the floating-point math unit which affect all programs running? Or has that knowledge I have in my mind become useless ever since the appearance of XP and cohorts? (It's been ages since I read about that stuff, heh.)
#3
Like I told Lasher if I restart mush with the decoder off it works fine if I open the decoder and send any output to the mud the stat window crashes. I'm using the old version because I customized the formatting to how I like it and I havent had any of the instances of bugs that other people have reported.

(Group) Starky: 'Quest completed with 16 + 2 and 4222 gold with an average of 15.9 qps per quest and 4822 gold per quest over 22 quests tracked. With a 88% quest completion percentage.'

is how the script with math.floor usually fires . The completion percentage rounds to 2 demcimals but it's an even number in that instance with the decoder open and the statwindow having crashed I completed a quest and got over 10 decimal points on each, I can intentionally crash it and finish a quest later if you want the exact output
Australia Forum Administrator #4
The bugs you mention haven't been reported here, or I would have fixed them.

Most of the plugins Lasher is making available I have written (or adapted in the case of the stats window). I have been playing Aardwolf fairly extensively over the last few days - purely to test of course - and have not found any bugs or crashes to speak of. Any I found have been fixed.

Can you please ask your friends who say there are bugs, to post the details here. In particular the error message, like you did, and the MUD output leading up to the bug.

If one person can report a bug in detail, it can save it affecting another thousand.

As for ffdshow, it sounds really bizarre that another program somehow causes Lua scripts to crash. If it is true it is interfering with the floating-point processor there isn't much I can do, however if you can reproduce it in a simple form I can go to the Lua mailing list with it.

Can you try my simple example in the Immediate window (Ctrl+I)?


a = 123.4545
print (a)   --> prints 123.4545
b = math.floor (a)
print (b)  --> prints 123


Try it before and after running ffdshow, and see if you get different results.

What processor and operating system are you using? For example, if you have a Celeron running Windows 98, maybe there is a known problem there. If we can narrow it down, that will help.
#5
I tried that snippet of code and it works before and after the codec is open, before and after statmon crashes every time, I triggered my spellup script and it went into one of those infinite loops after the statmon crash. Works fine without the codec open. Get the same crash error every time heres an example of my quest tracker output before I open the codec

(Group) Starky: 'Quest completed with 16 + 5 and 5188 gold with an average of 16.1 qps per quest and 4661 gold per quest over 38 quests tracked. With a 92.68% quest completion percentage.'

my last quest waiting for my next quest timer to tick as I type this I'll open the codec and crash the statmon before I complete it.

after

quest complete
You inform First Xythithan Kiri-Joloth that you have completed your quest.
First Xythithan Kiri-Joloth tells you 'Congratulations Starky on completing your quest!'
First Xythithan Kiri-Joloth tells you 'As a reward, I am giving you 20 quest points and 3697 gold.'
You gain an extra 2 quest points 'MCCP Bonus'.

6101/7288 83%hp 3576/5005 71%mn 5942mv 458tnl 419091gol 0tel 30quest (Reply: Mach)
Trigger function "Stat_Start" not found or had a previous error.
(Group) Mad Hermit Starky: 'Quest completed with 20 + 2 and 3697 gold with an average of 16.200000762939 qps per quest and 4646 gold per quest over 40 quests tracked. With a 93.019996643066% quest completion percentage.'

code snippet:


EnableTriggerGroup ("Ending", false)
var.questtotal = var.questtotal + var.questreward
var.quests = var.quests + 1
var.goldtotal = var.goldtotal + var.goldreward
var.questtotal = var.questtotal + 2
var.questbonus = var.questbonus + 2
var.questaverage = var.questtotal / var.quests
var.questaverage = var.questaverage * 10
var.questaverage = math.floor(var.questaverage)
var.questaverage = var.questaverage / 10
var.goldaverage = var.goldtotal / var.quests
var.goldaverage = math.floor(var.goldaverage)
var.completion = var.quests / var.totalquest
var.completion = var.completion * 10000
var.completion = math.floor(var.completion)
var.completion = var.completion / 100
SendNoEcho(
		<!--   Change the text in Quotes to change your display message -->
var.questchan .. " Quest completed with " .. 
var.questreward .. " + " .. 
var.questbonus .. " and " .. 
var.goldreward .. " gold with an average of " ..
var.questaverage .. " qps per quest and " ..
var.goldaverage .. " gold per quest over " ..
var.quests .. " quests tracked. With a " ..
var.completion .. "% quest completion percentage."
)



I'm running a dell dimension 4700 using XP, its mostly a standard system with memory and ram added on and an upgraded graphics card.
Amended on Wed 16 Jul 2008 07:23 AM by Starky
Australia Forum Administrator #6
I'm not sure how to respond here. I'm not sure if it is:

  • My fault
  • Lua's fault
  • ffdshow's fault


You say it "Works fine without the codec open." - that tends to suggest there is nothing wrong with the plugin. A plugin that fails if and only if you run some other totally unrelated program, well, what can I say? It sounds very strange.