alvieboy Report post Posted April 6, 2008 Hey, yesterday a guildmate (Minion07) spoke to me about how nice would be to have some text macros to write common stuff ( like #gm hello guild ). I found the idea interesting, and not very hard to code, so I took a few hours and implemented some basic stuff. The idea is to have 100 text macros, which can be bound with command "#bind", like "#bind 1 #gm Hello guild", and called by just entering "#N <parameters>", where N is the index of the macro. I did implement the basic without the parameters. You can check here a screenshot (some lines there are debug). Do you think it is useful ? This is only client-side, of course. Some people really would appreciate this feature. With parameters, you could write "#bind 1 Hey $1, you wanna PK?" and later just type "#1 somename". Thanks again to Minion07 for the idea. Álvaro Share this post Link to post Share on other sites
Minion07 Report post Posted April 6, 2008 i thought it would be really useful as i find myself typing things like #gm gratz <playername> all the time. Alvie's implementation so far looks really cool and hope other people like the idea. Share this post Link to post Share on other sites
alvieboy Report post Posted April 6, 2008 Ent, if you don't disagree with this feature, I shall move on to implement parametrisable macros. Code is not commited and won't be unless you say so. It's implemented as a client feature, so can be enabled/disabled at anyone discretion. Álvaro Share this post Link to post Share on other sites
Learner Report post Posted April 6, 2008 First thing ... don't call it macro ... macroing is specifically against the rules. Share this post Link to post Share on other sites
The_Piper Report post Posted April 6, 2008 Call it, what it is: an alias. #alias #unalias #aliases Just my 2 cents Piper Share this post Link to post Share on other sites
alvieboy Report post Posted April 6, 2008 Heh You both might be right. So let's call these "text aliases". Álvaro Share this post Link to post Share on other sites
Entropy Report post Posted April 7, 2008 I don't have a problem with that as long as it is not called "macro" (which would cause a lot of confussion). But, personally, I don't think they will be very usable. The problem, as I see it, is that typing "#N xxx" requires 8 key presses, and moving your hands to ackaward places (shift). "hello guild" is, IMHO, easier to type (no shift keys). Of course, if others found them useful, that's fine. Share this post Link to post Share on other sites
majestyk Report post Posted April 7, 2008 At the very least, it would be awesome for people who want to sell some stuff on the market channel. You create your selling slogan and alias it, and then you can just re-post in regular interval without having to go through your chat history every time. It would also be useful if those aliases could be kept persistent, written into a file or something, maybe even plain text so you can edit it afterwards? Share this post Link to post Share on other sites
alvieboy Report post Posted April 7, 2008 I don't have a problem with that as long as it is not called "macro" (which would cause a lot of confussion). But, personally, I don't think they will be very usable. The problem, as I see it, is that typing "#N xxx" requires 8 key presses, and moving your hands to ackaward places (shift). "hello guild" is, IMHO, easier to type (no shift keys). Of course, if others found them useful, that's fine. If you alias "#1" to "#gm Hello guild", you'll only need to type "#1", since you don't need parameters at all. The syntax is "#N", where N is a number between 0 and 99. Álvaro Share this post Link to post Share on other sites
LIGHTspeed Report post Posted April 7, 2008 (edited) This looks pretty nice. I just have one question: Is/Will there be any way to check what is assigned to each "not-a-macro"? If you set a LOT, it'd be pretty hard to remember them all. Lol P.s. Hopefully it's ok that I posted here... Edited April 7, 2008 by LIGHTspeed Share this post Link to post Share on other sites
alvieboy Report post Posted April 7, 2008 This looks pretty nice. I just have one question: Is/Will there be any way to check what is assigned to each "not-a-macro"? If you set a LOT, it'd be pretty hard to remember them all. Lol P.s. Hopefully it's ok that I posted here... You can either look at the configuration file or type in "#aliases", which will show you the list. I'm still not sure if I will use a paged approach to this command, cause you can have 100 aliases and thats a lot of info to show in the console. Álvaro Share this post Link to post Share on other sites
Minion07 Report post Posted April 7, 2008 (edited) Thats a lot of info to show in the console. Álvaro erm the #know command shows ~300 lines in console. Perhaps you can base it on that #aliases -- show all #aliases 40 -- show alias #40 maybe even #aliases 30-40 -- show range just a thought, but not sure how possible that is. Edited April 7, 2008 by Minion07 Share this post Link to post Share on other sites
alvieboy Report post Posted April 8, 2008 Perhaps you can base it on that#aliases -- show all #aliases 40 -- show alias #40 This one is easy and it's implemented as I write this. #aliases 30-40 -- show range Not so easy, cause it would require me to write another "parser" But I'll think about it. Álvaro Share this post Link to post Share on other sites
Raz Report post Posted April 8, 2008 Could you do #alias hello Which would display all aliases containing the word hello? Share this post Link to post Share on other sites
alvieboy Report post Posted April 8, 2008 Could you do #alias hello Which would display all aliases containing the word hello? yes, but like "#aliases hello". Álvaro Share this post Link to post Share on other sites
alvieboy Report post Posted April 8, 2008 Ok, now a screenshot of parameters working PS: do you know any good free image upload site ? Álvaro Share this post Link to post Share on other sites
alvieboy Report post Posted April 8, 2008 Some technical issues about this implementation: * It uses code from a patch I submitted to fix the "makeargv()/freeargv()" in windows platform (see here). It was never committed, but can be used from now on. Its required here to handle the parameters. * It uses a simple dynamic buffer implementation, which can be reused for whatever you like (documented for doxy, showing only the protos - the names are self explanatory): typedef struct { size_t alloc_size; /**< Current allocated size of buffer */ size_t current_size; /**< Current size used in buffer */ unsigned char data[0]; /**< Data placeholder */ } dbuffer_t; inline void dbuffer_destroy( dbuffer_t *dbuf ) inline UNUSED_RESULT_DECL dbuffer_t *dbuffer_append_data( dbuffer_t *dbuf, const unsigned char *data, size_t datalen ) inline dbuffer_t *dbuffer_new() inline dbuffer_t *dbuffer_sized(size_t datalen) inline dbuffer_t *dbuffer_new_with_data( const unsigned char *data, size_t datalen ) *`There's some code there also to "escape" strings to be written in files which might contain "weird" chars, by escaping them with octal values. This can also be used elsewhere if needed. Álvaro Share this post Link to post Share on other sites
alvieboy Report post Posted April 9, 2008 Hey all, it's in CVS now. Make sure to enable TEXT_ALIASES in make.conf. Tested build on linux and win32. Maybe some of you OSX guys could try building it too. Álvaro Share this post Link to post Share on other sites
Florian Report post Posted April 9, 2008 small fix for OSX is in CVS Share this post Link to post Share on other sites
rmiles Report post Posted April 9, 2008 I think that this would be a nice feature for commonly typed things. Share this post Link to post Share on other sites
Placid Report post Posted April 17, 2008 I don't have a problem with that as long as it is not called "macro" (which would cause a lot of confussion). But, personally, I don't think they will be very usable. The problem, as I see it, is that typing "#N xxx" requires 8 key presses, and moving your hands to ackaward places (shift). "hello guild" is, IMHO, easier to type (no shift keys). Of course, if others found them useful, that's fine. Well, that's if you're using a US-style keyboard layout. Of course, the rest of the world probably doesn't have to press as many keys. Personally I think the idea is excellent, and it's definitely something I'd use. Share this post Link to post Share on other sites
alvieboy Report post Posted April 17, 2008 Personally I think the idea is excellent, and it's definitely something I'd use. Great But, Ent also forgot that "hello guild" requires actually "#gm hello guild", which takes a shift. And really prefer using "#1", that's 3 keypresses. And my #2 is "#gm gratz $0", so I can type "#2 Placid". Álvaro Share this post Link to post Share on other sites
Fedora Report post Posted May 1, 2008 Very nice! But aliases like this, crash the client: #alias 1 #1 #1 I know i'm evil Share this post Link to post Share on other sites
alvieboy Report post Posted May 1, 2008 Very nice! But aliases like this, crash the client: #alias 1 #1 #1 I know i'm evil Yes, I know that. I'll commit a circular dependency check to avoid people doing it. Álvaro Share this post Link to post Share on other sites
Alberich Report post Posted July 7, 2008 Working excellent so far, thank you very much for this! just one little glitch, the last alias #99 isn't shown in the #aliases list Share this post Link to post Share on other sites