World of Warcraft WTF?



  • From http://forums.worldofwarcraft.com/thread.html?topicId=11381238&sid=1 (sorry, no direct link to post seems to be possible)

    Quote start:

    How do I register a /slash command? Credit: Jamash

    In my UI AddOn, what do I need to do to create a new "/slashcommand" that the user can type into the chat box?

    Slash command information is stored in two places. The first is a global table named SlashCmdList. In order to add a new command, create a new function with one argument. That argument will contain whatever text the user typed after the name of your command.

    MyAddon = {};

    function MyAddon.SlashCommand(Argument)

    DoSomethingWith(Argument);

    end

    Then create a new entry in the table for your new slash command.

    SlashCmdList["My_AddOn_Slash_Command"] = MyAddon.SlashCommand;

    The second place slash command information is stored is in a haphazard series of global variables. These variables' names all start with "SLASH_", then the name of an entry in SlashCmdList, and end with a digit. The value of each variable is the text the user types to active the command. It's important to note that while the names of the variables are case-sensitive, the command the user types is case-insensitive (so "/MASC", "/Masc" and "/masc" all do the same thing.

    SLASH_My_AddOn_Slash_Command1 = "/MASC";

    SLASH_My_AddOn_Slash_Command2 = "/MASlashCommand";

    SLASH_My_AddOn_Slash_Command3 = "/MyAddonSlashCommand";

    #End

    Is this a wtf or is there some strange reason why not somehing like this is used instead:
    AddSlashCmd({"/masc", "/MASlashCommand", ... }, MyAddon.SlashCommand);

    [edited by: mongoarne at 7:11 PM (GMT -5) on Mon, Jan 05 2009]
    Wow.. I guess this forum is the real WTF... If someone wants to tell me how to make it behave, I'll fix it






  •  From

    (sorry, no direct link to post seems to be possible)

     

    Quote start: How do I register a /slash command?

    Credit: Jamash In my UI AddOn, what do I need to do to create a new "/slashcommand" that the user can type into the chat box?

    Slash command information is stored in two places. The first is a global table named SlashCmdList. In order to add a new command, create a new function with one argument. That argument will contain whatever text the user typed after the name of your command. MyAddon = {}; function MyAddon.SlashCommand(Argument) DoSomethingWith(Argument); end

    Then create a new entry in the table for your new slash command. SlashCmdList["My_AddOn_Slash_Command"] = MyAddon.SlashCommand; The second place slash command information is stored is in a haphazard series of global variables. These variables' names all start with "SLASH_", then the name of an entry in SlashCmdList, and end with a digit.

    The value of each variable is the text the user types to active the command. It's important to note that while the names of the variables are case-sensitive, the command the user types is case-insensitive (so "/MASC", "/Masc" and "/masc" all do the same thing. SLASH_My_AddOn_Slash_Command1 = "/MASC"; SLASH_My_AddOn_Slash_Command2 = "/MASlashCommand"; SLASH_My_AddOn_Slash_Command3 = "/MyAddonSlashCommand";

    #End Is this a wtf or is there some strange reason why not somehing like this is used instead: AddSlashCmd({"/masc", "/MASlashCommand", ... }, MyAddon.SlashCommand);


    [edited by: mongoarne at 7:11 PM (GMT -5) on Mon, Jan 05 2009] Wow.. I guess this forum is the real WTF... If someone wants to tell me how to make it behave, I'll fix it

    First off, preview EVERYTHING. Oh right, you can't



  • @mongoarne said:

    Is this a wtf

    LUA is almost, but not quite, competitive with Community Server as far as WTFs go.  I especially like the periodic garbage collection sweeps, during which your WoW character's basically just frozen.  If your computer isn't fast enough, if your memory isn't large and/or fast enough, or if you're using addons which excessively task its garbage collection, this can easily result in one standing around for a few seconds every few minutes.

    Of course, it's been over a year since I've been free, so things may have changed since then.



  • @Ren said:

    First off, preview EVERYTHING. Oh right, you can't

    Preview works just fine for me, so long as I temporarily give this site authorization to run scripts.  Except, of course, that it doesn't provide a perfect Preview, as it's implemented with Javascript code, which is not perfectly replicated by the server side code.

    It did, of course, take me a while to find it, as most forums put the preview button by the submit button, rather than making it a tab at the top of the page.



  • @tgape said:

    Except, of course, that it doesn't provide a perfect Preview, as it's implemented with Javascript code, which is not perfectly replicated by the server side code.

    It is? Then why the heck does it always take so long to show?

    Also for the WTF:
    WTF meter doesn't make it past 15

    It might be a bit tedious, but it's understandable and there's documentation for it.



  • @rohypnol said:

    Yes, direct link is possible: http://forums.worldofwarcraft.com/thread.html?topicId=11381238&sid=1

    Actually I seem to recall that new users can't add links until they have a few posts under thier belt (half-arsed spam prevention)



  •  Don't know about that, but I know one thing: TDWTF RTE sucks0rz. By default, you have to select text and click on the link to create a href and you have to edit the html code to use colors. I'm afraid of checking out the advanced editor.



  • @rohypnol said:

    TDWTF RTE sucks0rz.
     

    In all curiosity, I'd like to know what browsers and settings people are using when they have such grave formatting issues. In a normal FFX installation, the rich text editor has no wtfs, save for the backspace-twice-delete bug.

    Disabling JS or explicitly using the lo-fi input box is fucked, because CS won't even do a formatting-101 newline => BR, and I believe Chrome+Safari = Webkit had some issues as well.

    FIY, the RTE is an instance of TinyMCE, which is also used by Wordpress. Any wtfs are the result of (in)Telligent's tinkering.



  • @dhromed said:

    @rohypnol said:

    TDWTF RTE sucks0rz.

    In all curiosity, I'd like to know what browsers and settings people are using when they have such grave formatting issues.

     

    OK, lemme rephrase that: TinyMCE seems to have some annoying issues. Using FF3x on Win32 and Mac with ABP (enabled) and Firebug (disabled), I get some exta whitespace at the end of the text from time to time, which doesn't always stick there and if I add my own space next to it and I erase my space, it erases both spaces and the character before them. Also, the fact that all the editor icons are enabled by default and the "link/unlink" icons are disabled is a bit of WTF and it takes a newcomer a bit to realize that the link is only enabled by selecting text. After selecting some text and deleting it with backspace, the icons remain enabled but they don't do anything. There were a couple of others, but I can't seem to remember them now.



  • Well good, it seems that your smaller issues are the same as everyone else's, including mine.

    I don't have trouble with the button bar, because I generally don't have trouble using button bars. I all honesty, I expect users of this site to be able to use one without problems as well.

     @rohypnol said:

    the link [button] is only enabled by selecting text.

    Not necessarily odd or a problem at all, but from another perspective it might make sense to have it behave the same as the B/I/U toggle buttons.

     



  • @dhromed said:

    Well good, it seems that your smaller issues are the same as everyone else's, including mine.

    I don't have trouble with the button bar, because I generally don't have trouble using button bars. I all honesty, I expect users of this site to be able to use one without problems as well.

     @rohypnol said:

    the link [button] is only enabled by selecting text.

    Not necessarily odd or a problem at all, but from another perspective it might make sense to have it behave the same as the B/I/U toggle buttons.


    Yeah, the problem is that it seems inconsistent.



  • @GettinSadda said:

    @rohypnol said:

    Yes, direct link is possible: http://forums.worldofwarcraft.com/thread.html?topicId=11381238&sid=1

    Actually I seem to recall that new users can't add links until they have a few posts under thier belt (half-arsed spam prevention)

    That doesn't seem to stop the periodic half-arsed spam attacks we have.



  • Lua is actually pretty nice, it sounds like they've just implemented it poorly.



  • Yes, it's a WTF, it really shouldn't be like that.



    It really should be something like:

    [code]

    MyAddon =

    {

    AddonCommands = {"/Masc", "/MASlashCommand" }

    }

    function MyAddon.SlashCommand(Argument)

    DoSomeStuff;

    end



    SlashCmdList["MyAddon"] = MyAddon;

    [/code]



    Or if you wanted to get fancy:

    [code]

    MyAddon =
    {

    function SlashCommand1(Argument)

    DoSomeStuff;

    end

    function SlashCommand2(Argument)

    DoSomeOtherStuff;

    end

    AddonCommands = {{"/Masc", SlashCommand1}, {"/MASlashCommand", SlashCommand2}}

    }

    SlashCmdList["MyAddon"] = MyAddon;

    [/code]

    The second is just off the top of my head, I mess around with Lua and the syntax might be a little off, but it gets the point across.

    The problem is that they've redesigned the architecture for the Lua UI several times since the release of the game. When they do that they leave a lot of cruft in to keep as many things backwards compatible as possible so people don't have to relearn things.



    A lot of the people making UI mods for WoW aren't programmers and some of the code is really scary. That's the main problem behind the WoW UI and the reason it freezes sometimes, it's not really the a problem with the GC as much as with anyone making a UI mod and not doing things the best way possible because they don't know how. That and the UI programming in general is a huge organic mess.



  • I guess it's because I use opera that the forum cracks up then.



  • @mongoarne said:

    I guess it's because I use opera that the forum cracks up then.
    Community Server seems to hate anything other than Firefox. I used to use IE, but TinyMCE would not load about 60% of the time, giving me weird JavaScript errors. Chrome and Opera give you the illusion the editor is working, except when you submit, all your text gets b0rked.

    I had to install Firefox on my work computer just to get the TDWTF forums working.



  • I say we need more browsers. Not only do I enjoy stumbling on web sites that don't work for my current browser, but as a web designer I positively love debugging CSS/HTML to cater to the current crop of browsers in use out there.

     



  • @dhromed said:

    Chrome+Safari = Webkit

    That is an odd equation. Since Webkit is a part of Safari, we know that Safari-Webkit=Safari's interface. So are you suggesting that Chrome is the negation of the user interface of Safari? And what would that even mean?



  • @danixdefcon5 said:

    Community Server seems to hate anything other than Firefox. I used to use IE, but TinyMCE would not load about 60% of the time, giving me weird JavaScript errors. Chrome and Opera give you the illusion the editor is working, except when you submit, all your text gets b0rked.

    It's more like Opera and Safari do not properly implement an RTF editor (may be a failure of your OS/platform to properly implement an RTF editor in some cases).  TinyMCE has options to alert Opera and Safari users that they suck, but evidently Community Server does not make use of them but instead lets the mangled formatting to be posted.  I guess they just figured any troglodyte still using Opera or Safari deserved to have their posts branded as badly-formatted garbage, lest anyone waste time reading them.



  • Works for me:  Mozilla/5.0 (Windows; U; Windows CE 5.2; rv:1.9.2a1pre) Gecko/20090106034601 Minimo/0.020

    Doesn't work for me: All the other browsers on my mobile device, from Internet Explorer Mobile to Opera Mobile to that funky Java one that nobody ever uses.



  • @lolwtf said:

    Lua is actually pretty nice, it sounds like they've just implemented it poorly.

    I looked over the official Lua documents.  It's a half-decent language - meaning that the other half isn't.  Of course, all languages suck, and it's a lot better than many others.

    That having been said, there were many notable differences between standard Lua and WoW's implementation, and they all sucked.  It was one of the reasons I quit playing.



  • @Lacutis said:

    A lot of the people making UI mods for WoW aren't programmers and some of the code is really scary. That's the main problem behind the WoW UI and the reason it freezes sometimes, it's not really the a problem with the GC as much as with anyone making a UI mod and not doing things the best way possible because they don't know how.

    Partially agreed.  They do things such as extra copying of large objects for temporary reference, exercising the GC.  Fixing up all of this kind of crud, and you only get freezes every hour or two.

    But a decent language would spread the GC hit around a bit more.  For example, in Perl, when you release some memory (for example, the variable goes out of scope or set to undef (Perl's equivalent to nil)), it's immediately released.  Releasing memory on demand like this means your computer is only slowed by a few microseconds here and there.  Of course, this requires a certain amount of discipline - you need to not use globals for temporary objects, as globals never go out of scope.

    Yes, I realize that Lua isn't the only language to rely entirely on a garbage collector for releasing memory - but all of the ones I can think of off the top of my head have reputations for having performance problems.  Not exactly the company I'd like to keep.



  • @tgape said:

    Releasing memory on demand like this means your computer is only slowed by a few microseconds here and there.
    It also means that your released objects cannot be re-used again so you have a performance hit everytime you create a new object. When an object goes out of scope it should be kept in a pool so it can be returned whenever you need a new object of the same type.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.