Jump to content
Eternal Lands Official Forums
alvieboy

Client text macro commands

Recommended Posts

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).

 

2001524762762955143_rs.jpg

 

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

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

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

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

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
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

This looks pretty nice. :D

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 by LIGHTspeed

Share this post


Link to post
Share on other sites
This looks pretty nice. :P

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
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 by Minion07

Share this post


Link to post
Share on other sites
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" :D

 

But I'll think about it.

 

Álvaro

Share this post


Link to post
Share on other sites
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

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

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
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
Personally I think the idea is excellent, and it's definitely something I'd use.

 

Great :P

 

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
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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×