• 0

    posted a message on Macro / Keybind Mod
    Quote from KHobbits

    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.
    Posted in: Minecraft Mods
  • 0

    posted a message on Macro / Keybind Mod
    Quote from dsohler

    … i want something like bind h /home in a simple config file


    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.

    Quote from dsohler

    You know a link to a working 1.2.5 version of ImprovedChat?


    Nope. ;)
    Posted in: Minecraft Mods
  • 0

    posted a message on Macro / Keybind Mod
    Quote from yankemdds

    Wow. I really durped that one. Apparently I completely missed that. Thanks for pointing it out.


    No problem.

    Quote from dsohler

    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.
    Posted in: Minecraft Mods
  • 0

    posted a message on Macro / Keybind Mod
    Quote from yankemdds

    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...
    Posted in: Minecraft Mods
  • 0

    posted a message on Macro / Keybind Mod

    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)

    Quote from AmbigramMan

    This is possible through scripting.
    if(~SHIFT);
      //Do something
    elseif(~CONTROL);
      //Do something else
    else;
      //Do another thing

    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.
    Posted in: Minecraft Mods
  • 0

    posted a message on Macro / Keybind Mod
    Quote from acuena

    Now I have this:

    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.

    Quote from Zaraxxas

    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.

    Quote from Zaraxxas

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


    This is possible through scripting.
    if(~SHIFT);
      //Do something
    elseif(~CONTROL);
      //Do something else
    else;
      //Do another thing

    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.
    Posted in: Minecraft Mods
  • 0

    posted a message on Macro / Keybind Mod
    Quote from acuena

    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.

    So, you have:
    MATCH(%CHAT%,(?:- %@&lastmsgname%:)(.*),@&lastmsg,1);
    IFMATCHES(%CHAT%,"wiylvl");
    Log("Whole string: %CHAT%");
    log("Sender: %@&lastmsgname% Message: %@&lastmsg%");
    ENDIF;

    However, because there is no value set for @&lastmsgname, it is looking for the following string:
    "- %@&lastmsgname%: [message]"

    To fix it, you have to add the other MATCH before the first one:
    MATCH(%CHAT%,(?:- )(.*)(?:\:),@&lastmsgname,1);
    
    MATCH(%CHAT%,(?:- %@&lastmsgname%:)(.*),@&lastmsg,1);
    IFMATCHES(%CHAT%,"wiylvl");
    Log("Whole string: %CHAT%");
    log("Sender: %@&lastmsgname% Message: %@&lastmsg%");
    ENDIF;


    Or, using Mart's new format:
    MATCH(%CHAT%,(?:- )(.*)(?:\:),@&lastmsgname,1);
    MATCH(%CHAT%,(?:- .+?\:)(.*),@&lastmsg,1);
    IFMATCHES(%@&lastmsg%,"wiylvl");
    Log("Whole string: %CHAT%");
    log("Sender: %@&lastmsgname% Message: %@&lastmsg%");
    ENDIF;


    I'm pretty sure you also have to escape the colon with a backslash \. But I'm not sure about that one.
    Posted in: Minecraft Mods
  • 0

    posted a message on Macro / Keybind Mod
    Quote from acuena

    Now I get "Sender: %@&lastmsgname% Message: %@&lastmsg%" in the chat. It wont output the variables it seems.

    What I want to do is:
    1. Any user writes a certain word, like: wiylvl (short for what is your lvl)
    2. Then the script answers with a PM to the user who sent it what my level is
    The code I have now is:

    MATCH(%CHAT%,(?:- %@&lastmsgname%:)(.*),@&lastmsg,1);
    IFMATCHES(%CHAT%,"wiylvl");
    Log("Whole string: %CHAT%");
    log("Sender: %@&lastmsgname% Message: %@&lastmsg%");
    ENDIF;


    And again the format of the chat string is: - <name>: <message>

    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.
    Posted in: Minecraft Mods
  • 0

    posted a message on Macro / Keybind Mod
    Quote from acuena

    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:

    MATCH(%CHAT%,(?:- %@&lastmsgname%:)(.*),@&lastmsg,1);
    Log("Sender: %lastmsgname%  Message: %lastmsg%");


    The format of the chat lines are as follows: - Acuena: message
    What are I missing?

    Maybe this mod needs a seperate forum for thoose that uses it :P
    Are alot of free ones that could be used.


    I think I see the problem. For your LOG statement, you have:
    Log("Sender: %lastmsgname%  Message: %lastmsg%");

    You need to change that to
    Log("Sender: %@&lastmsgname% Message: %@&lastmsg%");
    Posted in: Minecraft Mods
  • 0

    posted a message on Macro / Keybind Mod
    Quote from DanceSC

    I love you

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

    Try this:
    ifmatches(%CHAT%,: Dance\??$);
      echo("Yes?");
    endif

    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.
    Posted in: Minecraft Mods
  • 0

    posted a message on Macro / Keybind Mod
    Quote from DanceSC

    @mart3323 the sims part was a joke xD.

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

    Your hard work is greatly appreciated.


    Put this in onChat:
    $${
    IFCONTAINS("%CHAT%","dance");
      ECHO("Yessum?");
    ENDIF
    }$$

    If that doesn't work, you could also try using IFMATCHES(%CHAT%,dance); instead of the IFCONTAINS
    Posted in: Minecraft Mods
  • 0

    posted a message on Macro / Keybind Mod
    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?

    Quote from Mumfrey
    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.
    Posted in: Minecraft Mods
  • 0

    posted a message on Macro / Keybind Mod
    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! :P
    Posted in: Minecraft Mods
  • 0

    posted a message on Macro / Keybind Mod
    Quote from acuena


    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:

    Quote from Mart3323

    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"
    MATCH(%CHAT%,(?:<)(.*)(?:>),@&lastmsgname,1);
    MATCH(%CHAT%,(?:<%@&lastmsgname%>)(.*),@&lastmsg,1);

    so <Glasher143> help, my dog needs ironing
    becomes
    Glasher143 and help, my dog needs ironing
    Posted in: Minecraft Mods
  • 0

    posted a message on Macro / Keybind Mod
    Quote from Mumfrey

    Thanks for your patience, 0.8.7 is now uploaded and the following changes and fixes are included:
    • Updated for Minecraft 1.2.5
    • Added option to log sent messages in the local chat history (defaults to off)
    • Added RANDOM, TIME and PLAYSOUND script actions
    • Added optional 5th parameter to MATCH to specify default value to use if the match fails
    • Event bind buttons now have icons
    • Event-specific help content added when editing an event binding
    • Added YAW, PITCH and DIRECTION global variables
    • Added onPickupItem and onPlayerJoined events
    • Fixed list parameters not retriggering macro compilation
    • Made some improvements to the key injection subsystem to support more reliable injection of key events


    Woot! Things are about to get fun... :)
    Posted in: Minecraft Mods
  • To post a comment, please .