Hi, I was looking to see if there was any more scripting functions or if there is any better documentation as to what is available.
I was thinking of running up a script which does an action any time something is said in chat, but didn't see any way to do any sort of string manipulation/checking/comparison.
The readme is slightly out of date, this is entirely possible with the latest version of the mod, which supports RegEx style string comparisions. IFMATCHES("string",pattern) can be used to compare a string to a regex pattern, and MATCH("string",pattern,&varname,group) will set the result of a specified capturing group to &varname, or the entire result if the group is missing or zero. If you really are from the essentials team, I am going to assume that you know how to do this, but feel free to post if you need help.
Nice mod, but I don’t want to install and configure a space shuttle cockpit, when I just want to make a paper plane.
Is there a SIMPLE mod that allows me to put a defined command on a defined key (nothing more)?
The beauty of this mod is that it's only as complex as you make it. To make a simple keybind, just open the mod's GUI, click the button you want to bind, and type in what you want it to say. Couldn't be easier.
Of course, if you REALLY don't want this mod, you can try ImprovedChat, but I've never used it, so no guarantees.
Can anyone tell me why this isn't working? Instead of waiting it's putting it all out instantly. There's a couple more lines I'd like to add but if I use them I get kicked for flooding even though it's in the faction only chat where only my faction members can see it.
-snip-
Assuming that that is EXACTLY what you have the macro set to, you are missing a bunch of closing parentheses ")". The last wait doesn't have any parentheses at all. If that is just a forum typo, then you may have a bug. Someone else was saying that wait() wasn't working for them either a few pages back, so...
So sad that it does not support binding different functions on the same key but with different modifier keys...
Until that, this mod will be far inferior to improvedchat.
(Let me know if I'm wrong and that can be done, I want to hear that :3)
However, LWJGL doesn't correctly detect the ALT key, which will make it freeze the game and open up the menu that pops up when you right click the title bar. Using other keys that you have already bound a macro to would be tricky, if not impossible, without firing both macros.
MATCH(%CHAT%,(?:- )(.*)(?::),@&lastmsgname,1);
MATCH(%CHAT%,(?:- .+?:)(.*),@&lastmsg,1);
IFMATCHES(%@&lastmsg%,"wiylvl");
wait(3);
log("/msg >%@&lastmsgname%< My level is: %LEVEL%");
ENDIF;
The ">%@&lastmsgname%<" part is just for testing.
The problem I now have is that it runs it twice. I only want it to run one time.
The output from it is: /msg >Acuena< MY level is: <level>
If I change the log line to: echo("/msg %@&lastmsgname% My level is: %LEVEL%");
It runs over and over again.
And looks like it triggers otherwise to...
Maybe need to clear the variables between each run?
Any clue on why?
I would try enclosing the entire thing in an IFMATCHES(%CHAT%,?:- .+?: .*) to check to make sure that the message is actually a chat message, though Mart's method should work.
I have a a feature request: Is there the possibility to disable the execution of what is usually on the specific key (a macro or a mod) when the chat is opened?
I am a server admin and my keyboard is full of keys for different mods and macros. The macro override function is very useful if all keys already used. With your mod I have completely new possibilities e.g. for the usage of world edit (of course I use the world_edit_clientside interface mod, so I can see which area is marked). I put the world_edit commands //copy and //paste to ctrl+c and ctrl+v, what worked great. But when I opened the chat to copy or paste sth. with ctrl+c or ctrl+v in the chat the mod wants to execute the mod with //copy and //paste instead.
This is already included, look in the options tab.
Is there also the possibilty not only to have the override function with ctrl+sth. but also to add the possibility to define a free combination of keys? (e.g ctrl+f does xyz ; alt+f does 123 ; or if someone wants it e.g. x+f does abc)
It would be great for all those who wish to have a second keyboard, because on their first there is no key which is not used
However, LWJGL doesn't correctly detect the ALT key, which will make it freeze the game and open up the menu that pops up when you right click the title bar. Using other keys that you have already bound a macro to would be tricky, if not impossible, without firing both macros.
I want the name of the player who sent the text because I want to send it back to him with a personal message so I don't show it to all on the server. The problem I have is when I trigger the script it outputs the variable name in my chat. Here is a image of how it appears for me:
I want it to write it out like this "Sender: Acuena Message: miylvl"
Care to explain?
I have no idea on what you mean. I am very new to scripting and RegEX.
Essentially, you need to have two different RegExes to capture the two different areas of the string that you want, the name, and the message. Each MATCH can only capture one area, so you require on for each.
I might be a total noob with RegEx but I tried to get the sender and the message out with the code AmbigramMaa posted about.
I am then trying to Log it out to me to se if it works, but it sends the code line I used to post it to myself.
Here are my code:
EDIT: Ok, I tested it out and because my name was dance, it just spammed the chat.
So I changed it to IFMATCHES(%chat%,": Dance");echo(Yes?);endif
That worked because at the end of a players name is a colon then a space. However, if someone typed "dance is awesome"
It would still have me auto respond with "Yes?" Which doesn't make sense at all... So I'm not sure how I would use this feature :S
OH. I see what you want now. I didn't realize your name was dance before
That should work. It's a simple regex that will match if someone only says "Dance" or "Dance?". The $ sign marks the end of a string, so it will only match if they only say your name. This does have some drawbacks, for example "Dance, are you there?" won't fire it, but it will work for what you want I think. Also, make sure not to add any quotation marks. It breaks it for some reason. (the % signs are still required)
I could also make one that will never register for you if you want me too, using the regex that Mart posted a ways back to get the player's name. It will only work for the vanilla chat format though, just so you know.
I do however need help with something. What would I need to type to make it so if some random player types "dance" in chat, I would auto respond with "yessum?"
Hey Mumfrey. You should see if you can add a volume variable to the playsound() function. Would be nice, as I have a script that tells me if someone is trying to talk to me while I'm afk. I still want to hear the sound it plays even if I have my volume turned down.
EDIT: Oh, also, if we have AudioMod installed, will we automatically be able to play mp3s? Or would you have to separately program that in?
I've gone with case-insensitive matching everywhere for now, I may add flag in the future like perl has to set either case-sensitive matching or to strip colour codes and similar. At the moment colour codes are left in because they're actually useful to match against!
What character is used to represent the § symbol used in character codes? I see that if I log a string with color codes from a server, it colors it correctly. However, if I echo it back to the server, the color code symbol is replaced with a "?". I'm using a period for it right now, but being more specific is always good.
Hey Mumfrey, is it possible to use the case insensitive mode in a regex? It would be rather useful, as I am trying to make a regex that tells me if someone says my name on my server.
EDIT: Nevermind, should have finished reading the page on the command lines!
The problem with a %FROM% variable is that many servers have different formats for the chat messages. You can, however, just cut out the name with a regex. If the server you are on is vanilla, there was a script a ways back for this. I'll go hunt it down and stick it here. If the server isn't vanilla (Bukkit for example), you may have a different text string, and you will likely have to go make you're own regex format for it.
Here's an "OnChat" script for you guys that creates 2 global variables, one to store only the username (without brackets), and one to store the message
Right now this only works for messages in the default format of "<somename> hey guys"
0
The readme is slightly out of date, this is entirely possible with the latest version of the mod, which supports RegEx style string comparisions. IFMATCHES("string",pattern) can be used to compare a string to a regex pattern, and MATCH("string",pattern,&varname,group) will set the result of a specified capturing group to &varname, or the entire result if the group is missing or zero. If you really are from the essentials team, I am going to assume that you know how to do this, but feel free to post if you need help.
0
Precisely. Exact steps: Install Modloader. Place mod in "mods'' folder. Open Minecraft. Join server/load world. Press sneak+grave key ( ` ). Press "H". Type "/home". Press enter. Done.
Nope.
0
No problem.
The beauty of this mod is that it's only as complex as you make it. To make a simple keybind, just open the mod's GUI, click the button you want to bind, and type in what you want it to say. Couldn't be easier.
Of course, if you REALLY don't want this mod, you can try ImprovedChat, but I've never used it, so no guarantees.
0
Assuming that that is EXACTLY what you have the macro set to, you are missing a bunch of closing parentheses ")". The last wait doesn't have any parentheses at all. If that is just a forum typo, then you may have a bug. Someone else was saying that wait() wasn't working for them either a few pages back, so...
0
0
I would try enclosing the entire thing in an IFMATCHES(%CHAT%,?:- .+?: .*) to check to make sure that the message is actually a chat message, though Mart's method should work.
This is already included, look in the options tab.
This is possible through scripting.
However, LWJGL doesn't correctly detect the ALT key, which will make it freeze the game and open up the menu that pops up when you right click the title bar. Using other keys that you have already bound a macro to would be tricky, if not impossible, without firing both macros.
0
Essentially, you need to have two different RegExes to capture the two different areas of the string that you want, the name, and the message. Each MATCH can only capture one area, so you require on for each.
So, you have:
However, because there is no value set for @&lastmsgname, it is looking for the following string:
To fix it, you have to add the other MATCH before the first one:
Or, using Mart's new format:
I'm pretty sure you also have to escape the colon with a backslash \. But I'm not sure about that one.
0
Wait, you do have the first MATCH as well, right? The one that actually gets @&lastmsgname? If you don't, the whole thing will fail.
0
I think I see the problem. For your LOG statement, you have:
You need to change that to
0
OH. I see what you want now. I didn't realize your name was dance before
Try this:
That should work. It's a simple regex that will match if someone only says "Dance" or "Dance?". The $ sign marks the end of a string, so it will only match if they only say your name. This does have some drawbacks, for example "Dance, are you there?" won't fire it, but it will work for what you want I think. Also, make sure not to add any quotation marks. It breaks it for some reason. (the % signs are still required)
I could also make one that will never register for you if you want me too, using the regex that Mart posted a ways back to get the player's name. It will only work for the vanilla chat format though, just so you know.
0
Put this in onChat:
If that doesn't work, you could also try using IFMATCHES(%CHAT%,dance); instead of the IFCONTAINS
0
EDIT: Oh, also, if we have AudioMod installed, will we automatically be able to play mp3s? Or would you have to separately program that in?
What character is used to represent the § symbol used in character codes? I see that if I log a string with color codes from a server, it colors it correctly. However, if I echo it back to the server, the color code symbol is replaced with a "?". I'm using a period for it right now, but being more specific is always good.
0
EDIT: Nevermind, should have finished reading the page on the command lines!
0
I used the http://www.regular-expressions.info/ to learn about RegEx, you could try starting there.
The problem with a %FROM% variable is that many servers have different formats for the chat messages. You can, however, just cut out the name with a regex. If the server you are on is vanilla, there was a script a ways back for this. I'll go hunt it down and stick it here. If the server isn't vanilla (Bukkit for example), you may have a different text string, and you will likely have to go make you're own regex format for it.
EDIT: Ok, here is the post with the script in it:
0
Woot! Things are about to get fun...