• 0

    posted a message on Escaping Strings
    Thank you for the explanation :)
    Posted in: Lua Code Discussion
  • 0

    posted a message on Escaping Strings
    Hi,

    I hope this turns out to be another simple question to answer. :)

    I've been trying to work out how to escape strings so I can use string.match. I found this function:

    function escape(s)
        return (s:gsub('[%-%.%+%[%]%(%)%$%^%%%?%*]','%%%1'):gsub('%z','%%z'))
    end


    I swiped it from here. I have to admit I don't understand the rest of the code. Although I think I understand most of the function above - except the last gsub.

    Why? What have "z"s done to deserve special treatment?
    Posted in: Lua Code Discussion
  • 0

    posted a message on Registering/Unregistering OnUpdate
    I didn't want to create another frame just for the Update script if I could help it. but perhaps I'm worrying over nothing.

    thanks for your reply.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Registering/Unregistering OnUpdate
    Hi,

    I hope this is a quick question. I'm not keen on putting code in the OnUpdate of a frame, mainly because my code doesn't need to run all the time. At the moment I am using 1 var and an if statement to disable my code. But that still means the if statement is still being tested even though it fails.

    I can't help thinking that I could register the OnUpdate only when I need it, then unregister it after. When I've looked at other addons, I've not noticed this kind of activity. Registering events, yes, but not scripts.

    So, in short, why? Does registering and unregistering a script lots of times* cause other issues?


    * I realise that the register/unregister functions would probably take more processing power than an if statement, so it would depend on just how many. What I want to do is:
    1. Register
    2. 1-x seconds OnUpdate activity
    3. Unregister
    4. idle for x seconds to x minutes
    5. repeat
    Posted in: Lua Code Discussion
  • 0

    posted a message on Accented Letters
    Thanks for the information. I've learned something new about my text editor and UTF8. :) I was saving files as ansi.

    I've not had much time to look in detail, but I seem to remember a bit about string.char not being OS independent. As WoW runs on Windows and Mac, I'd want to test how Blizzard's code handles this.

    Also, Blizzard's code seems to be inconsistent in the way string.xxx functions handle UTF8. Sometimes an accented letter magically become 2 chars when using certain functions. Hence the TitleCase function, I nicked from elsewhere.

    Ofc, this all could be down to gaps in my knowledge, so when I have time - I shall keep looking.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Accented Letters
    Quote from Phanx
    Well, based on your description it sounded like you had a setup where the players themselves were typing the name of the character they wanted to bring to the raid on a forum, and the raid leader was then copying those names from the forum and pasting them in-game. Presumably a player should know how to type any accented letters in thier character's name.


    Nope, Players point and click to sign up to an event. The event administrator, then selects the players and the toon they will play and their role. This is the list that gets typed. The event administrator is not always the person leading the raid.

    Quote from Phanx
    If the names are being typed by the raid leader, you could add a "virtual keyboard" next to the text entry field with buttons to click to add accented letters at the current cursor position. Such a system should work equally well using Lua in your addon, and JavaScript on your forum if you wanted to duplicate it there.


    I like the idea of a point and click solution for the website, but I don't have the knowledge or the access to implement such a change.

    Quote from Phanx
    If the names are being typed by the raid leader, though, it seems like there are a number of methods you could use that would be easier and less prone to user error. For example, your addon could list all of the level-85 characters in your guild and split them up by class. The raid leader could then simply check off all of the DKs he wanted to invite, all of the druids, all of the hunters, etc. and the addon could generate a list with all of the correct letters. If the list needed to be posted on a forum as well, the addon could populate a text entry field with the list, so the raid leader could copy it from in-game and paste it on the forum.


    I'm not convinced of the benefits for your in game solution. Unless the user could remember all attendees, they would still need to alt-tab between game and browser. So it would have to be a particularly fancy window for the user to think it's better than using the existing guild roster window to send invites manually.

    I'm a "new" member in a well established guild. I don't want to bore peeps with details of our administration procedures, which I can't change. So I need to make my addon look simple, flexible and be able to fit into established routines.

    If you fancy being horrified, the latest version of my addon can be found here. I have coded for "Imanidiot" type duplicates, but there aren't any in my guild, so I've not properly tested or implemented that feature.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Accented Letters
    "Ímånìdîõt"

    hehe. While I would agree with your sentiment if we were talking about native English speakers - the problem is, we're not. This is Europe, native English speakers are very much the minority.

    For most of my guild members, accented letters are a part of every day life. So I must respect and accommodate these linguistic differences. And it doesn't help that different European languages use different accented letters. So not all players can type every variation.

    My addon provides an edit box for the text entry. If I find duplicate names, I can update that text and ask the user to edit. Everyone can delete. :)

    Thank you for your replies.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Accented Letters
    In a word, yes. My guild uses a website calendar to arrange raids. Attending Toon names are listed on the site. Using my addon, the raid leader can copy+paste the list of names into my addon, which will then send out group invites to those toons.

    What I want to do create a function so I can reuse it anywhere:
    
    if RemoveAccents (Var1) == RemoveAccents (Var2) then
    ...
    end
    
    Posted in: Lua Code Discussion
  • 0

    posted a message on Accented Letters
    Hi,

    All of the very few peeps to use my addon are based in Europe. And being "Johnny Foreigners" they will insist on using "funny" letters (ÐãØë?). The problem is, not everyone can easily type all of them. So most of the time they use the non-accented version (DaOeC). This, ofc, makes string matching impossible.

    The only solution I can think of, is some sort of look up table. But I can't help thinking there's a more cleaver way of solving it. Would anyone have any alternative suggestions or ideas?

    Edit: Sorry, I forgot to make it clear that my tongue is firmly in cheek for the first part. :)
    Posted in: Lua Code Discussion
  • 0

    posted a message on Quest Events, etc.
    Thanks for your suggestions. It's done the trick.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Quest Events, etc.
    Hi,

    I've been reading up about the quest functionality and it seems to me that there's an event for everything except when the user clicks on the "complete" button on a quest.

    Before I start trying to build some complicate solution, is there something I've missed?
    Posted in: Lua Code Discussion
  • 0

    posted a message on How to display the "Standard" tooltip?
    Thanks for the info, Now Christmas is over, I've got a tooltip working. :) Now I just need to see if I can move it.
    Posted in: Lua Code Discussion
  • 0

    posted a message on How to display the "Standard" tooltip?
    Hi,

    I have a very basic window where the user can drag and drop an item from their inventory and the item's icon is nicely displayed. What I would like to add is the display of the same tooltip I get when I hover over the same item in my bag, but to appear when I hover over the icon in my window.

    I know that I can create my own tooltip, but that won't display the same information. If it's at all possible, I'd like to be able to "trick" other addons into thinking it's the "real thing" so they display their information as well.

    I've been struggling to "decode" other addons to see how I can find a solution to what I want to do. I am hoping there's some simple function, but part of me is thinking that's too easy. Is there a solution? (and will I understand, but that can wait. ;))
    Posted in: Lua Code Discussion
  • 0

    posted a message on Code to Change Text Colour
    Thanks for the replies, the format command is just the thing I'm looking for.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Code to Change Text Colour
    Hi,

    When I want to change the colour of text sent to the chat window I use hexadecimal, like "|cffffff00". What I would like to do, is be able to do is select from a range from RGB (255,0,0) to RGB (0,255,0) (for example).

    But as far as I can tell, you need to use the hexadecimal value, not RGB. Being lazy I was hoping there might be someone willing to let me borrow their code ;D or would you have any other suggestions?
    Posted in: Lua Code Discussion
  • To post a comment, please or register a new account.