Hello, has anybody an idea for a stack drop script?
I would drop all stacks cobblestone in my inventory, but nothing from my hotbar.
Would be nice, if any has an idea.
Im trying to make a macro that will greet a new player to a server i play on. i assume i need to use the JOINED PLAYER command. so this is what im using right now.
Welcome $${JOINEDPLAYER}$$ To (server name)!!! Have Fun and Good Luck!!! =D
but i also only want it to initialize if its a new player, where the server says: Welcome (name of subject) To The Server!
Hi, i´ve a little problem with this mod, when i bind a script to a key, for example F12, then in-game i hit F12, the script are executed two or three times at the same time, i need to be very fast tapping F12, to get only one instance of the script running, is there a way to avoid this??
Some kind of validation that is the script are running not let any other instance run, for example:
I was wondering if there was some way you could make a kind of automatic wheat harvester.
I would what the seeds in the first slot and the bone meal in the second you would place the seeds then inventoryup then use the bonemeal to grow it break the wheat and inventoryup and place more seeds with (do(64). I have tried to do this but i can't find a way how to place the seeds in script key(use) doesn't word. It would awesome if you could help me! thanks you
Im trying to make a macro that will greet a new player to a server i play on. i assume i need to use the JOINED PLAYER command. so this is what im using right now.
Welcome $${JOINEDPLAYER}$$ To (server name)!!! Have Fun and Good Luck!!! =D
but i also only want it to initialize if its a new player, where the server says: Welcome (name of subject) To The Server!
help would be lovely
Well the welcoming part is easy. JOINEDPLAYER is a variable that is provided only inside the onPlayerJoined event handler. So to do the welcoming part you just need to put the following in onPlayerJoined.
$${ECHO("Welcome %JOINEDPLAYER% to Server Name!");}$$
It's necessary to use ECHO because you want to insert the variable value into the text.
To do the second option is more complicated because you need to read the incoming chat, but not overly so. Basically it involves the use of regular expressions to both recognise and extract part of the chat, and then act upon it. This script can be used in onChat:
IFMATCHES(%CHATCLEAN%,"Welcome ([a-z0-9_]{2,16}) To The Server!",&player,1);
ECHO("Hey %&player%, welcome to the server!");
ENDIF;
Notice that this time we use a user variable called &player to extract the player name from the chat. The % signs tell the mod to insert the value of the variable.
I've presented it on multiple lines for clarity, but you can put it all on one line in the event handler:
$${IFMATCHES(%CHATCLEAN%,"Welcome ([a-z0-9_]{2,16}) To The Server!",&player,1);ECHO("Hey %&player%, welcome to the server!");ENDIF;}$$
You could also (alternatively) paste the code I showed you into a text file called "welcome.txt" and then just attach the file to the event handler using an include:
$${$$<welcome.txt>}$$
this tends to make scripts a little easier to maintain, since you don't need to put everything on one line any more.
Hi, i´ve a little problem with this mod, when i bind a script to a key, for example F12, then in-game i hit F12, the script are executed two or three times at the same time, i need to be very fast tapping F12, to get only one instance of the script running, is there a way to avoid this??
Some kind of validation that is the script are running not let any other instance run, for example:
There's no way for a macro to access the running state of another macro, and besides in your example the macro would detect itself running in any case. It might make more sense with the EXEC if you could assert that a task is not running before starting it, but this is not currently supported.
The easiest way to do what you want is to manually create a mutex on the script using something like:
IF(!running);
SET(running);
// do stuff in the task
UNSET(running);
ENDIF;
Although of course if you STOP() the task or quit the game whilst its running you'll need to reset the mutex somehow. Of course you could put the mutex on the macro that's launching the script and use a 1 second "debounce":
To be honest though it's best to find the source of the issue if you're getting these multiple keypress events. 9 times out of 10 it's the keyboard or driver that's the issue.
You probably know already, but since no one has said it yet..., *ahem*
1.4.6 is out \o/
Lol, I know :), but don't feel like you have to make up for the morons just because none have shown up yet! The files are on the server, I uploaded them last night I just haven't had a second to make the release post yet. Anyway, welcome to the wonderful world of array variables!
-999 is the slot for dropping items? Or does any nonexistant ID do that? I was wondering about that since you didn't document how to click outside of inventory.
Yes, don't ask me why but the minecraft internals uses -999 as a semaphore for when you click outside the window in a container. Probably should document that somewhere
Mumfrey, would it be possible, if I put armor pieces in certain slots in my inventory, and made a macro for the mod to try to put on the armor every time I hit the keybind?
Fixed escaping for quotation marks in strings, literal quotes can now be escaped with \
Added php-style array push syntax to assignment expressions
Added configurable foreground & background colours to button controls
PROMPT now supports an optional fifth parameter "default" which is returned if the user presses ESC in the prompt GUI.
Notes about arrays
The syntax to refer to "whole array" in circumstances where it is ambiguous is the array name followed by empty square brackets, for example:
UNSET(&var); // Unset a string scalar called &var
UNSET(&var[]); // Delete a string array called &var
In some settings this is optional, for example FOREACH will treat a scalar name as an array because you can't iterate over a scalar!
FOREACH(&var,&v); // These two statements work the same but
FOREACH(&var[],&v); // this one is slightly clearer
I decided in the end that arrays should be unbounded since I found they could get quite large without significant performance impact. Usable indices extend up to 99999 which should be enough for anyone's purposes. If you still run out of indices I suggest you do whatever it is that you're doing some other way because a macro is clearly not what you need!
Adding entries to the end of an array can be done using PUSH or the PHP-style push syntax:
Array entries can be inserted/set at any index, arrays that don't exist will be created, arrays which are too short will be extended:
&arr[0] = "I";
&arr[1] = "like";
&arr[2] = "big";
&arr[4] = "and I can not lie";
Notice that array entry 3 is omitted, after this code the array will have a length of 5 and entry 3 will be empty. These empty entries are virtual (take up no storage space) and read like ordinary entries. However they have a special behaviour which can be invoked using the PUT command:
PUT(&arr,"butts");
PUT will find the first virtual entry in the array and insert the value at that point, if no free space is found then the behaviour is the same as PUSH (ie. the value will be appended to the array).
Arrays can also be used to accept all groups that are the result of a MATCH:
&test = "Mary had a little lamb";
MATCH(%&test%,"^(\w+) (\w+)",&matches[]); // Notice the array syntax using []
In this example the array will contain the following entries:
[0] => "Mary had"
[1] => "Mary"
[2] => "had"
Notice that like most regex implementations, group zero is the full match, with groups 1 and above corresponding to capturing subpatterns in the regex.
Mumfrey, would it be possible, if I put armor pieces in certain slots in my inventory, and made a macro for the mod to try to put on the armor every time I hit the keybind?
Yes this kind of thing is pretty easy if you're using fixed slots. The first thing to do is go into the mod settings and enable the "Show slot ID's in containers" option. Now whenever you open a container you will get a tooltip showing the slot ID's
Next you need to just work out what order you need to click the slots in, I suggest getting a piece of paper to write down the order. Open the GUI you want to use (in this case your inventory) and write down the list of clicks you make, and whether it's a left or right click.
Once you've done that you just write out a macro which opens the gui, clicks the slots in the correct order, then closes the gui again:
The call to GUI() at the end will close the GUI. This example clicks the first four slots in the inventory (9, 10, 11, 12) and the armour slots (5, 6, 7, 8), but of course you can click any slots that you like to perform any inventory management functions that you wish. If you need to right click you can use:
Just wanted to note that if I stop it with stop() it stops like it should.
It's derpy as hell, it's just something I was playing with. Basically it connects a mob movement AI to the player, which means overriding the input so yes you can't press anything until it succeeds or until you STOP() the macro. Try different values for the search radius and don't walk too far because it tends to have a shit fit under certain circumstances
It's quite fun trying to get it to navigate your house though, or walk around town. It's just no use whatsoever for most things, it's just an experiment. I left it in for people who are likely to dig around in the internals to kind of play with. I was going to call it ZOMBIE because that's essentially what it does. Anyway, keep it on the hush hush because it's really not ready for prime time at the moment.
Thanks for adding arrays Mumfrey, can't wait to experiment with them. Also, will the Chatfilter Module work with 1.4.6 or does it need to update as well?
Thanks for adding arrays Mumfrey, can't wait to experiment with them. Also, will the Chatfilter Module work with 1.4.6 or does it need to update as well?
The chatfilter needs updating because the internal API version has changed, I'll upload the recompiled version later.
If i want to make so that i can use on key on my keybord, to first //expand vert then /rg d $$! and then /rg setparent $$!
Is there a way to make that happed in one click?
Just separate each command with pipes and use a named parameter instead of a stop directive:
//expand vert|/rg d $$[region]|/rg setparent $$[parent]
java.lang.IllegalArgumentException: URI is not hierarchical
at java.io.File.<init>(File.java:363)
at net.eq2online.macros.compatibility.Reflection.GetSubclassesFor(Reflection.java:147)
at net.eq2online.macros.scripting.ScriptAction.Init(ScriptAction.java:677)
at net.eq2online.macros.core.Macros.<init>(Macros.java:221)
at net.eq2online.macros.core.MacroModCore.<init>(MacroModCore.java:276)
at net.eq2online.macros.core.MacroModCore.GetInstance(MacroModCore.java:233)
at net.eq2online.macros.LiteModMacros.init(LiteModMacros.java:47)
at com.mumfrey.liteloader.core.LiteLoader.initMods(LiteLoader.java:592)
at com.mumfrey.liteloader.core.LiteLoader.initLoader(LiteLoader.java:222)
at com.mumfrey.liteloader.core.LiteLoader.getInstance(LiteLoader.java:161)
at bch.<clinit>(RenderLightningBolt.java:14)
at bbu.<init>(RenderManager.java:174)
at bbu.<clinit>(RenderManager.java:96)
at net.minecraft.client.Minecraft.a(Minecraft.java:423)
at asq.a(SourceFile:56)
at net.minecraft.client.Minecraft.run(Minecraft.java:744)
at java.lang.Thread.run(Thread.java:680)
java.lang.IllegalArgumentException: URI is not hierarchical
at java.io.File.<init>(File.java:363)
at net.eq2online.macros.compatibility.Reflection.GetSubclassesFor(Reflection.java:147)
at net.eq2online.macros.scripting.ScriptAction.Init(ScriptAction.java:677)
at net.eq2online.macros.core.Macros.<init>(Macros.java:221)
at net.eq2online.macros.core.MacroModCore.<init>(MacroModCore.java:276)
at net.eq2online.macros.core.MacroModCore.GetInstance(MacroModCore.java:233)
at net.eq2online.macros.LiteModMacros.init(LiteModMacros.java:47)
at com.mumfrey.liteloader.core.LiteLoader.initMods(LiteLoader.java:592)
at com.mumfrey.liteloader.core.LiteLoader.initLoader(LiteLoader.java:222)
at com.mumfrey.liteloader.core.LiteLoader.getInstance(LiteLoader.java:161)
at bch.<clinit>(RenderLightningBolt.java:14)
at bbu.<init>(RenderManager.java:174)
at bbu.<clinit>(RenderManager.java:96)
at net.minecraft.client.Minecraft.a(Minecraft.java:423)
at asq.a(SourceFile:56)
at net.minecraft.client.Minecraft.run(Minecraft.java:744)
at java.lang.Thread.run(Thread.java:680)
Welcome $${JOINEDPLAYER}$$ To (server name)!!! Have Fun and Good Luck!!! =D
but i also only want it to initialize if its a new player, where the server says: Welcome (name of subject) To The Server!
help would be lovely
Some kind of validation that is the script are running not let any other instance run, for example:
EXEC("script.txt","MyMacro");
and in script.txt:
IF(RUNNING("MyMacro"));
LOG("Already running");
ELSE;
............
I would what the seeds in the first slot and the bone meal in the second you would place the seeds then inventoryup then use the bonemeal to grow it break the wheat and inventoryup and place more seeds with (do(64). I have tried to do this but i can't find a way how to place the seeds in script key(use) doesn't word. It would awesome if you could help me! thanks you
Well the welcoming part is easy. JOINEDPLAYER is a variable that is provided only inside the onPlayerJoined event handler. So to do the welcoming part you just need to put the following in onPlayerJoined.
It's necessary to use ECHO because you want to insert the variable value into the text.
To do the second option is more complicated because you need to read the incoming chat, but not overly so. Basically it involves the use of regular expressions to both recognise and extract part of the chat, and then act upon it. This script can be used in onChat:
Notice that this time we use a user variable called &player to extract the player name from the chat. The % signs tell the mod to insert the value of the variable.
I've presented it on multiple lines for clarity, but you can put it all on one line in the event handler:
You could also (alternatively) paste the code I showed you into a text file called "welcome.txt" and then just attach the file to the event handler using an include:
this tends to make scripts a little easier to maintain, since you don't need to put everything on one line any more.
There's no way for a macro to access the running state of another macro, and besides in your example the macro would detect itself running in any case. It might make more sense with the EXEC if you could assert that a task is not running before starting it, but this is not currently supported.
The easiest way to do what you want is to manually create a mutex on the script using something like:
Although of course if you STOP() the task or quit the game whilst its running you'll need to reset the mutex somehow. Of course you could put the mutex on the macro that's launching the script and use a 1 second "debounce":
Which may be the best way to go.
To be honest though it's best to find the source of the issue if you're getting these multiple keypress events. 9 times out of 10 it's the keyboard or driver that's the issue.
Added to the wish list
1.4.6 is out \o/
'Cause tomorrow spring is here
Lol, I know :), but don't feel like you have to make up for the morons just because none have shown up yet! The files are on the server, I uploaded them last night I just haven't had a second to make the release post yet. Anyway, welcome to the wonderful world of array variables!
Yes, don't ask me why but the minecraft internals uses -999 as a semaphore for when you click outside the window in a container. Probably should document that somewhere
(Yes I can't wait until you post the changelog)
Macro/Keybind mod Wiki
Download links
Changes in 0.9.7
Notes about arrays
The syntax to refer to "whole array" in circumstances where it is ambiguous is the array name followed by empty square brackets, for example:
In some settings this is optional, for example FOREACH will treat a scalar name as an array because you can't iterate over a scalar!
I decided in the end that arrays should be unbounded since I found they could get quite large without significant performance impact. Usable indices extend up to 99999 which should be enough for anyone's purposes. If you still run out of indices I suggest you do whatever it is that you're doing some other way because a macro is clearly not what you need!
Adding entries to the end of an array can be done using PUSH or the PHP-style push syntax:
Array entries can be inserted/set at any index, arrays that don't exist will be created, arrays which are too short will be extended:
Notice that array entry 3 is omitted, after this code the array will have a length of 5 and entry 3 will be empty. These empty entries are virtual (take up no storage space) and read like ordinary entries. However they have a special behaviour which can be invoked using the PUT command:
PUT will find the first virtual entry in the array and insert the value at that point, if no free space is found then the behaviour is the same as PUSH (ie. the value will be appended to the array).
Arrays can also be used to accept all groups that are the result of a MATCH:
In this example the array will contain the following entries:
Notice that like most regex implementations, group zero is the full match, with groups 1 and above corresponding to capturing subpatterns in the regex.
Sorry :C
Just wanted to note that if I stop it with stop() it stops like it should.
Macro/Keybind mod Wiki
Yes this kind of thing is pretty easy if you're using fixed slots. The first thing to do is go into the mod settings and enable the "Show slot ID's in containers" option. Now whenever you open a container you will get a tooltip showing the slot ID's
Next you need to just work out what order you need to click the slots in, I suggest getting a piece of paper to write down the order. Open the GUI you want to use (in this case your inventory) and write down the list of clicks you make, and whether it's a left or right click.
Once you've done that you just write out a macro which opens the gui, clicks the slots in the correct order, then closes the gui again:
The call to GUI() at the end will close the GUI. This example clicks the first four slots in the inventory (9, 10, 11, 12) and the armour slots (5, 6, 7, 8), but of course you can click any slots that you like to perform any inventory management functions that you wish. If you need to right click you can use:
and to "hold down shift while clicking" do:
It's derpy as hell, it's just something I was playing with. Basically it connects a mob movement AI to the player, which means overriding the input so yes you can't press anything until it succeeds or until you STOP() the macro. Try different values for the search radius and don't walk too far because it tends to have a shit fit under certain circumstances
It's quite fun trying to get it to navigate your house though, or walk around town. It's just no use whatsoever for most things, it's just an experiment. I left it in for people who are likely to dig around in the internals to kind of play with. I was going to call it ZOMBIE because that's essentially what it does. Anyway, keep it on the hush hush because it's really not ready for prime time at the moment.
Thanks for your help
Works fine
And how can i add more than one items, for example add dirt and gravel?
Edit:
Ah, I found it
Here for all, but thats for a txt file
The chatfilter needs updating because the internal API version has changed, I'll upload the recompiled version later.
Actually you don't need to run the loop 3 times, just make the IF condition read as "this id or that id or another id", like this:
Just separate each command with pipes and use a named parameter instead of a stop directive:
Okay, i searched the command for "or", but i have only knowledge in SPS (programmable logic controller)
And there are the functions "or" "and" etc.
java.lang.IllegalArgumentException: URI is not hierarchical
at java.io.File.<init>(File.java:363)
at net.eq2online.macros.compatibility.Reflection.GetSubclassesFor(Reflection.java:147)
at net.eq2online.macros.scripting.ScriptAction.Init(ScriptAction.java:677)
at net.eq2online.macros.core.Macros.<init>(Macros.java:221)
at net.eq2online.macros.core.MacroModCore.<init>(MacroModCore.java:276)
at net.eq2online.macros.core.MacroModCore.GetInstance(MacroModCore.java:233)
at net.eq2online.macros.LiteModMacros.init(LiteModMacros.java:47)
at com.mumfrey.liteloader.core.LiteLoader.initMods(LiteLoader.java:592)
at com.mumfrey.liteloader.core.LiteLoader.initLoader(LiteLoader.java:222)
at com.mumfrey.liteloader.core.LiteLoader.getInstance(LiteLoader.java:161)
at bch.<clinit>(RenderLightningBolt.java:14)
at bbu.<init>(RenderManager.java:174)
at bbu.<clinit>(RenderManager.java:96)
at net.minecraft.client.Minecraft.a(Minecraft.java:423)
at asq.a(SourceFile:56)
at net.minecraft.client.Minecraft.run(Minecraft.java:744)
at java.lang.Thread.run(Thread.java:680)
The OR operator is ||, if you look at the script I posted I already explained this.
Ok I'll look at it when I get home.
Can you make a .zip version?