When I parse the servers reply to my /money command (BTW it was the %CHAT% I didn't know I could use) I can isolate the number. However when I submit it to the server it gets unhappy because the number contains commas and a decimal but it wants an integer. I have tried looking for help using RegEx to no avail. How can I remove the commas?
Hmm, I haven't tried it but you could try assigning the captured string to a counter variable, this would essentially call Integer.parseInt() on the value and may ignore the commas, or it may choke on it and just assign zero. Give it a try.
And I was wondering, are you planing on implementing math functions (+ - * / operators)? And use varName = value instead of SET();? Would be great if I could do something like donate only 75% of my money to my town. Turring completeness is nice. . .
Mathematical operators are on the roadmap for the version after 0.9. My focus at the moment is on the newer trigger mechanisms for macros, in particular bringing events up to where I want them functionality-wise and adding the custom GUI functions for the macro playback screen. These are the key features I've slated for 0.9 and are the current thrust of development. The reason events seem a bit rough around the edges and unloved is that as it exists in 0.8.5 it's really just a general testbed for the events, 0.9 will make them seem more like a first-order feature in the mod.
I noticed that the text boxes you use are not the same as the rest of MC, they have always been better. Until now, with 1.2.4 they lack some of the functionality. Are you planing on implementing something more like the chat GUI (with copy and paste support)?
There are actually 2 types of text box in the mod, GuiTextFieldEx which just added scrolling support and will be phased out in favour of the new text boxes, and also GuiTextFieldMacroEdit, which is a little more involved and supports syntax highlighting which I will merge some of the newer textbox functionality into, it's a little too complicated to throw away completely because the syntax highlighting is a bit of a nightmare.
While working with the RegEx I noticed that any time I made a syntax error Minecraft will crash. It would be nice if macro mod would catch the error and prevent the total crash.
Should now catch this in 0.8.3, the catch clause in that class wasn't quite as wide as it should have been!
BTW, the fishing script was derived from a YouTube video.
It does not work in 1.2.4 as the video describes it. And it does edit default classes. However I hope this info at least gives you some idea of how to proceed.
I'll check it out, it's definitely something I'm considering but I have to try to prioritise what features to add.
As feared, it returns a zero. "11" returns as 11 but "1,1" returns as 0.
Mathematical operators are on the roadmap for the version after 0.9. My focus at the moment is on the newer trigger mechanisms for macros, in particular bringing events up to where I want them functionality-wise and adding the custom GUI functions for the macro playback screen. These are the key features I've slated for 0.9 and are the current thrust of development. The reason events seem a bit rough around the edges and unloved is that as it exists in 0.8.5 it's really just a general testbed for the events, 0.9 will make them seem more like a first-order feature in the mod.
The bold, what do you mean by that? It made me think of an idea (which may in fact be what you are talking about), the ability to create our own GUI, with buttons to select that run scripts. Effectively infinitely increasing the number of scripts we can run, since we can always add more buttons.
I forgot to mention this in my last post, when you use ECHO(); the new chat system will store it in you chat history. This can cause some unanticipated problems when you attempt to repeat a command. Is there a way to keep ECHO() commands from showing up there? (or scrub them out immediately). Or perhaps a parameter for the ECHO() function to choose to store it in history or not. I came across this testing RegEx, as I would send a chat containing a string to parse, and it would then use the ECHO() function. If it came out wrong, I would edit and resend the chat, which should be the last thing I sent, but instead I keep sending the last ting the script echoed. There is more history, so I can press up twice, but it would be nice if I did not have to. Not a big deal, just annoying.
I dunno why you would bother making a watered down version when the full version will work Mumfrey.. screw that is my opinion, waste of time. Leave the servers to their politics, players wanting to use awesome mods like this, should find other servers not run by those with this mentality.
I go with the "don't ask don't tell" mentality. Just use the mod, and don't do anything that seems like it is against the rules. For instance, the above automine script is probably considered cheating on most servers, so don't do it. Be smart, as long as you are know you are not cheating the server admins do not need to know.
I use onJoinGame to LOG() the Rei minimap entity radar/cavemap enabler sting. That way it always is enabled on any server. Some people might call it cheating, I don't think it is. I will keep doing it until I get board with MC and stop playing. Nobody has to know.
EDIT:
For some reason fishing poles do not trigger the onDurabilityChange event
Let me start by saying you have done an awesome job with this mod Mumfrey! Really like it!
I do have a question though. I was trying to setup a menu like command for all the different /warp /homes /tp /msg features on my server. /snip
Hi, sorry for the super-slow reply but I kind of got side-tracked by the whole password theft fiasco and I wanted to answer this one in full.
Ok this probably requires some explaining, it is possible to achieve what you want, but it needs some background information.
Parameters in macros are not dynamic, they are not part of the macro's execution but are instead hints to the macro compiler that it needs to "fill in" some information before the macro is run. When you create a macro what you actually create is a Template, and this is what the macro parser compiles when you trigger the macro.
In a simple example, you might have the following template:
/give Mumfrey $$? 64
It's pretty clear what this macro does and when it's invoked the macro parser sees the $$? parameter and prompts you for the value. If you enter 322 at the prompt, the macro parser replaces the value you type in and then essentially begins again, checking for parameters. Only when there are no more parameters will the macro actually be sent for execution.
So with our example, the final "compiled" macro is a single chat message action which contains the compiled text:
Chat Message=[/give Mumfrey 322 64]
Only templates which are triggered by key events can prompt for parameters, event templates and spun-off templates cannot prompt for parameters, although spun-off templates can accept parameters passed in with the originating EXEC command. The reason for this is that there's no way to tell when these type of macros may be triggered, and having them pop up asking for input at random times would be disruptive.
There is one type of parameter which is always processed however, and that is the file include parameter, written as $$<filename.txt>. This type of parameter is always processed first and is processed even in macros which can't prompt the user for parameters. Let's assume we have a file containing the following script:
file.txt
/give Mumfrey $$? 64
/gamemode Mumfrey 0
Next we write a macro with the following code and bind it to a key:
Foo bar baz|$$<file.txt>
When this macro is executed, the compiler first looks for parameters in the macro that need replacing. Since file includes have the highest priority they get processed first. This means the macro looks like this after the first step:
Foo bar baz|/give Mumfrey $$? 64|/gamemode Mumfrey 0
Notice that the include changes line breaks in the file into pipe characters as you'd expect. At this point there's still a parameter in the macro however, so the compiler loops back to the start and checks again for parameters. This time it finds the $$? parameter and prompts the user for input, the user enters 46 at the prompt.
As you can see, the final macro which is executed has all of the parameters "filled in", and the macro which is actually executed is just the final, compiled chat commands as 3 separate actions to execute.
Let's look at an example with scripts. Imagine you have the following script in a file:
Like before, we can bind the file to a key using an include parameter. In this case we need to remember to put script delimiters around the include so that the included file will be treated as a script, but this happens later than you might imagine.
Notice that while the parameters are fully resolved before the macro is executed, the variable ~CTRL is not, this is the key difference between parameters and variables. Parameters are replaced during compilation to "build" the macro, and variables are evaluated while the macro is running. It should be clear by now that until the macro is fully compiled, it has no idea whether a parameter is going to be needed or not because the early part of the compiler that replaces the parameters is not even aware that the script is a script.
You can however harness the recursive nature of the early compiler to achieve what you want:
Consider the following simple macro:
/give Mumfrey $$?
When this macro is triggered, the user is prompted for an input. The user enters "$$i $$[amount]" which makes the macro
/give Mumfrey $$i $$[amount]
The user is now prompted for an item and amount, even though those parameters didn't exist at the start. This is because the compiler is recursive, and after a parameter is entered it goes "back to the start" and looks for more parameters!
You can also do this cunningness with file includes, let's assume we have 2 script files:
warps.txt
/warp $$w
homes.txt
/hg $$h
and our macro like this:
$$<$$[Option[warps,homes]].txt>
The first valid parameter found by the parser will be the list (even though file includes are processed first it won't include a file called "$$[Option[warps,homes]].txt" because it's not a valid file name in the mod's filter. So let's say you choose "warps" from the list:
$$<warps.txt>
Holy crap it's a valid file include! So what do we get?
/warp $$w
Finally there's a valid warp prompt, so the user is prompted for the warp to use and chooses the "TownCentre" warp, there are no more parameters so we are left with
Chat Message=[/warp TownCentre]
So why use EXEC if you can just do stuff with includes?
Well includes allow you include a lot more in a macro than would be possible with only 1 line, including the content to fill out a macro with more complex behaviour and in most cases this is what you should use. However what they don't allow you to do is "spin off" tasks which run independently of the original macro, for example if you want to run multiple background tasks then EXEC is your man. The limitation with EXEC is that it essentially builds a temporary template, known as a "spun off" template. The following EXEC builds a spun off template like this:
EXEC("script.txt")
$${$$<script.txt>}$$
But because the template is spun off, it cannot collect parameters from the user.
My plan is to add a script function to bring up the prompt at a later date, so that you can for example do PROMPTFOR("town",&townvar) and have the result stored in a variable (rather than a parameter), this will allow you to do some funky stuff including putting the prompts inside IF clauses. However I need to separate the GUI code from the compiler a little bit more before this is possible, so it's a ways away yet.
Hope this helps, the reason for the rather in-depth response is I hope it may help other readers get an idea about parameters and the macro compilation process too.
EDIT: It seems I've derped in 0.8.6 when adding lists and they don't trigger recompilation like they should, I'll release a fix when I am able. For now if you use a preset parameter inside the file include with your list of choices in the preset list then it should work:
The Meaning of Life, the Universe, and Everything.
Join Date:
2/28/2011
Posts:
147
Minecraft:
Nitephyre
Xbox:
Nitephyre
PSN:
Nitephyre
Member Details
Hmm, is anyone else having an issue now with MOUSE3 & MOUSE4 activating the game menu screen when pressed? It only seems to happen when not in fullscreen.
- can I construct command/macro with recursive content ? Example: I need write down command like this "/shop create <shopname> <shoppedItemId>[,<shoppedItemId>][,<shoppedItemId>] ...etc...". I can make macro "/shop create $$[Shopname] $$i,$$i,$$i" but the $$i parameter wil be asked only once and selected itemId replace all occurences of $$i. Can be the same parameter asked more times ? And if I don't enter it the recursive part of macro will end ???
EDIT:
I have read your previous post and my second question could be probably solved by recursive method: instead of $$i,$$i... I'll use $$5 (predefined list). The will include "$$i $$5" and "$$i". As long as I choose "$$i $$5" I can repetedly add more and more item parameters. As I choose "$$i" the macro compilation ends. Is it right ?
Correct, you seem to have answered your own question
Thanks a lot for the little module, ive just tested it, works wonderfully.
I can't thank you enough for your incredibly quick replies and admire your apparent dedication.
If you don't mind, id be interested in the mod code, id be happy if you pmed me that link too
Also the complete class code for the little module, so i have a template for my own plugins.
I have one little problem:
As I mentioned before, im using xdotools with this SHELL command now to complement the functionality. in particular, im moving items out of furnaces, chests, brewingstands with xdotools. unfortunately the keybord-part of xdotools does not work in minecraft, i can only move the mouse and emulate clicks (maybe of course im just too stupid).
However, id like to be able to shift-click, so the minecraft client will be responsible for the placement of items. xdotools doesnt let me, i tried things like
which do not work. Is there a way to make this dirty workaround work, or is the "layer of emulation" - if thats a fitting term - not low enough?
KEYUP, KEYDOWN, KEY and TOGGLEKEY are "high level" and work with the minecraft Keybind class. However there are two functions in the mod which are so low that they're positively dirty. These are the PRESS and TYPE commands, these functions inject raw events into the keyboard buffer between when LWJGL polls the input devices and them being read by any other part of the game, these fake events need to be injected every tick if you want to simulate holding down a key.
The approximate order of processing is something like this:
Minecraft calls Display.update() at the END of its tick
Display.update() causes LWJGL to poll the OS's input event queue and maps these events into its internal buffers
Minecraft starts a new tick
Macros mod deconstructs the LWJGL buffer using reflection and adds and removes key events as needed
Minecraft runs through its normal tick process using the manipulated buffer
Since I imagine that xdotools is actually injecting events into the OS buffer, you should still be able to harness the buffer manipulation functionality, but you need to inject the SHIFT key each tick for as long as you need, so for 4 ticks use
Or alternatively, is there any wisdom you have for me, so i wont have to do things as dirty as that? ^^
Well I don't know what brewempty.sh does, but if you're ok with shell scripting then I imagine java's not much of a challenge, I've sent you a copy of the current API via PM so you may be able to achieve what you want through that means.
Hmm, is anyone else having an issue now with MOUSE3 & MOUSE4 activating the game menu screen when pressed? It only seems to happen when not in fullscreen.
This comes up a lot, it's a bug with certain java/lwjgl versions
Indeed, you won't see any problems with the middle mouse because that's accessed through lwjgl. The reason most mods and Minecraft itself can't access those buttons is because LWJGL doesn't provide access to them. The method I use is to query them using jinput (which is a dependency of lwjgl so is available as a library without having to force people to download extra native libraries).
Unfortunately on some operating systems/configurations windows still grabs those events and causes the window to become defocused like you're experiencing, this in turn causes the game to pause and bring up the menu, this isn't just with Java 7 but also Java 6 on some operating systems. The key point is that it's not a bug in the game or in the mod, but something native in the way the window is capturing the mouse that causes the window to lose focus when the mouse3/4 buttons are pressed.
At the current time I really don't have an answer as to why this happens, putting the game in fullscreen always fixes the issue, and others have had success by starting minecraft then clicking off the window and back onto the window, so it may be that this works for you. Java 7 is still in beta so it may be that the final release will fix this issue but somehow I doubt it. Sorry I can't really solve this for you, but further experimentation may help.
So, Mumfrey, I have a few more feature requests after playing around with scripting some more (You may/probably have at least a few of these planned, but hey). First, an onChatSend event, which would trigger when the user sends a message or command, would be immensely useful. It should probably contain a SENTCHAT variable or something similar containing the chat text. Next, an onPlayerJoin event which would fire whenever another player joins a multiplayer server would be useful. An onPlayerApproach event would be immensely useful in PvP servers/worlds, to give an early warning of possible hostilities.
Next, some actual scripting requests. It would be cool if we could choose a display name for list items. For instance, if I wanted to make a macro that allows me to select a chat channel to switch to, instead of having options for G, L, or T; I could make them say Global, Local, and Trade instead. These next two would mainly be used in math when it comes out. A RAND(lowerlimit, upperlimit) function could be nice, especially for aesthetic reasons (instead of repeating the exact same message every time, you could make a macro choose randomly between three or four). Also, an absolute value symbol/function would be ideal, making certain calculations a whole lot easier (example, when calculating the dimensions of an area selected with macros). Finally, It would be cool if SET() could be used on counters to set them to a specific number.
This next request would probably be very useful to people. If we had the ability to place text on different screens from macros, that would be amazing. You could a function such as TEXT(orientation, left/top/right/bottomPadding, "text", "textID", screen) to initialize it. Orientation would roughly position the text on the screen (top, left, bottom-right, for example). The four Paddings would allow for more accurate text positioning. The textID would be a unique identifier for that specific piece of text, for use in other functions. Screen would set what screen the text would be displayed on (example: options, chat, signedit, etc.) and could be left blank for it to always be displayed. Then an EDITTEXT("textID", "newText") function would be used to change what a specific section of text says. Finally, DELTEXT("textID") would be used to completely remove the text section. I'm not entirely sure if this one would be possible without changing base classes, but it would be immensely useful.
Finally, and I am fairly sure that this can't be done, but I thought I would put it up just in case. Could we access exterior programs in-game? Like, say I wanted to make a macro that would skip the song I'm currently playing in Windows Media Player. I know that WMP has an API for this kind of thing (I think that's the correct term), as Rainmeter plugins can interface with it, but I don't know if it is possible to do it from Minecraft/Java.
Wow, that's a lot of text. Also, the newest version looks epic, and I can't wait for bukkit/my server to update to 1.2.4 so I can play around with it. As always, thanks for this most awesome of mods.
WOW this mod is INCREDIBLE! way better than improved chat! only thing i would want more is the ability to scroll through more chat then normal (i didnt actually check if you added that yet.. if you did then congrats you've killed improved chat :D)
I've installed modloader, and done everything it says to do in the instructions. And minecraft runs fine, I just can't figure out if the mod actually installed or how to open up the macro thing. Shift + grave does nothing.
The Meaning of Life, the Universe, and Everything.
Join Date:
2/19/2011
Posts:
84
Member Details
Is there any way of making a script to act as the Counter Strike/Team Fortress 2 quickswich bind? Like you press "q" and it switches between the 2 last used tools/weapons.
First of, as per my self defense ( ) i'd like to say that i'm no spammer or griefer in any way.
So my question is this: Would it be possible to have some text be spammed/looped to be posted all the time?
IF i recall corrently there is already an anti-spam in minecraft, but none the less, would is be possible to spam something?
I do not know the commands exactly, but i would guess it would be something like:
Chat("SPAM, spam, SPAM, spam...");
Wait(100ms);
Loop();
Now this is just a random idea, and was wondering if possible, as it could have a use, if used with a /* command i suppose. Maybe a manual server save?
All i want to know if something like that is possible, and if so, how would i go about doing it?
I honestly got no intention of spamming the **** out of a server, it'll only get people annoyed or mad at me, which in the end, leaves me in the spot of being "Alone" as none would in the end have me on their servers. And i just do not wish for that :/
The Meaning of Life, the Universe, and Everything.
Join Date:
2/28/2011
Posts:
147
Minecraft:
Nitephyre
Xbox:
Nitephyre
PSN:
Nitephyre
Member Details
Hmm, is there any way to toggle CJBs speed mode? It's keybind is LSHIFT but when I try and get MM to toggle it, nothing happens. It works when I use SPRINT() though.
I've installed modloader, and done everything it says to do in the instructions. And minecraft runs fine, I just can't figure out if the mod actually installed or how to open up the macro thing. Shift + grave does nothing.
As it was to my annoyance too, and others I took the liberty of making two small mods:
1: ChatBufferMod (changes limit from 100 to 1000)
2: ChatScrollMod (changes chat scroll from 7 to 5, can make it lower per request)
No ModLoader required!
In my opinion these options should be incorporated into Optifine, seems like the best place, I picture it with graphical menu options to change the backlog and to change the scroll speed. I however do not have the knowledge to do such a thing on short notice but enjoy
So this makes the chat history last a lot longer, wanna make one to allow post counts from what they are to 1k(or higher)? xD
Idc if it kicks you for 5 posts in a row, I want it ._.
Rollback Post to RevisionRollBack
I began minecraft ~July 7 2011 1.7.3 Beta
My username used to be Creative_Dalek but is now Dalek since 2/4/2015
Not sure if there's an option and I'm just not seeing, it, but whenever i reload Minecraft my current bind configuration switches to the default one, which isn't so bad, but it's annoying to switch it back to my custom config whenever I start up. Is their a way to have it start on one other then default?
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"
Edit: changed code to make the two matches work on their own, instead of the second match relying on the first
so <Glasher143> help, my dog needs ironing
becomes
Glasher143 and help, my dog needs ironing
Now, trying to expand this to save the last message, whisper, and server broadcast..., i've run into a problem
how can i check whether the match is successful?, can i?
I tried checking if the variable it matches to has changed, but i think i'm using IF wrong
I looked through the readme on how to use an IF, and it didn't help =(
*i probably should've used one IF with 2 checks, i always forget that's possible, but i'm pretty sure that's not important right now
Hmm, I haven't tried it but you could try assigning the captured string to a counter variable, this would essentially call Integer.parseInt() on the value and may ignore the commas, or it may choke on it and just assign zero. Give it a try.
Mathematical operators are on the roadmap for the version after 0.9. My focus at the moment is on the newer trigger mechanisms for macros, in particular bringing events up to where I want them functionality-wise and adding the custom GUI functions for the macro playback screen. These are the key features I've slated for 0.9 and are the current thrust of development. The reason events seem a bit rough around the edges and unloved is that as it exists in 0.8.5 it's really just a general testbed for the events, 0.9 will make them seem more like a first-order feature in the mod.
There are actually 2 types of text box in the mod, GuiTextFieldEx which just added scrolling support and will be phased out in favour of the new text boxes, and also GuiTextFieldMacroEdit, which is a little more involved and supports syntax highlighting which I will merge some of the newer textbox functionality into, it's a little too complicated to throw away completely because the syntax highlighting is a bit of a nightmare.
Should now catch this in 0.8.3, the catch clause in that class wasn't quite as wide as it should have been!
I'll check it out, it's definitely something I'm considering but I have to try to prioritise what features to add.
I'll pm you a link to the current source.
The bold, what do you mean by that? It made me think of an idea (which may in fact be what you are talking about), the ability to create our own GUI, with buttons to select that run scripts. Effectively infinitely increasing the number of scripts we can run, since we can always add more buttons.
I forgot to mention this in my last post, when you use ECHO(); the new chat system will store it in you chat history. This can cause some unanticipated problems when you attempt to repeat a command. Is there a way to keep ECHO() commands from showing up there? (or scrub them out immediately). Or perhaps a parameter for the ECHO() function to choose to store it in history or not. I came across this testing RegEx, as I would send a chat containing a string to parse, and it would then use the ECHO() function. If it came out wrong, I would edit and resend the chat, which should be the last thing I sent, but instead I keep sending the last ting the script echoed. There is more history, so I can press up twice, but it would be nice if I did not have to. Not a big deal, just annoying.
I go with the "don't ask don't tell" mentality. Just use the mod, and don't do anything that seems like it is against the rules. For instance, the above automine script is probably considered cheating on most servers, so don't do it. Be smart, as long as you are know you are not cheating the server admins do not need to know.
I use onJoinGame to LOG() the Rei minimap entity radar/cavemap enabler sting. That way it always is enabled on any server. Some people might call it cheating, I don't think it is. I will keep doing it until I get board with MC and stop playing. Nobody has to know.
EDIT:
For some reason fishing poles do not trigger the onDurabilityChange event
Hi, sorry for the super-slow reply but I kind of got side-tracked by the whole password theft fiasco and I wanted to answer this one in full.
Ok this probably requires some explaining, it is possible to achieve what you want, but it needs some background information.
Parameters in macros are not dynamic, they are not part of the macro's execution but are instead hints to the macro compiler that it needs to "fill in" some information before the macro is run. When you create a macro what you actually create is a Template, and this is what the macro parser compiles when you trigger the macro.
In a simple example, you might have the following template:
It's pretty clear what this macro does and when it's invoked the macro parser sees the $$? parameter and prompts you for the value. If you enter 322 at the prompt, the macro parser replaces the value you type in and then essentially begins again, checking for parameters. Only when there are no more parameters will the macro actually be sent for execution.
So with our example, the final "compiled" macro is a single chat message action which contains the compiled text:
Only templates which are triggered by key events can prompt for parameters, event templates and spun-off templates cannot prompt for parameters, although spun-off templates can accept parameters passed in with the originating EXEC command. The reason for this is that there's no way to tell when these type of macros may be triggered, and having them pop up asking for input at random times would be disruptive.
There is one type of parameter which is always processed however, and that is the file include parameter, written as $$<filename.txt>. This type of parameter is always processed first and is processed even in macros which can't prompt the user for parameters. Let's assume we have a file containing the following script:
file.txt
Next we write a macro with the following code and bind it to a key:
When this macro is executed, the compiler first looks for parameters in the macro that need replacing. Since file includes have the highest priority they get processed first. This means the macro looks like this after the first step:
Notice that the include changes line breaks in the file into pipe characters as you'd expect. At this point there's still a parameter in the macro however, so the compiler loops back to the start and checks again for parameters. This time it finds the $$? parameter and prompts the user for input, the user enters 46 at the prompt.
This means the final macro consists of 3 actions:
As you can see, the final macro which is executed has all of the parameters "filled in", and the macro which is actually executed is just the final, compiled chat commands as 3 separate actions to execute.
Let's look at an example with scripts. Imagine you have the following script in a file:
script.txt
Like before, we can bind the file to a key using an include parameter. In this case we need to remember to put script delimiters around the include so that the included file will be treated as a script, but this happens later than you might imagine.
after the file is included becomes:
There are still parameters though so the user is prompted for the value:
Now the macro is fully compiled (there are no more parameters to parse), so we end up with:
Notice that while the parameters are fully resolved before the macro is executed, the variable ~CTRL is not, this is the key difference between parameters and variables. Parameters are replaced during compilation to "build" the macro, and variables are evaluated while the macro is running. It should be clear by now that until the macro is fully compiled, it has no idea whether a parameter is going to be needed or not because the early part of the compiler that replaces the parameters is not even aware that the script is a script.
You can however harness the recursive nature of the early compiler to achieve what you want:
Consider the following simple macro:
When this macro is triggered, the user is prompted for an input. The user enters "$$i $$[amount]" which makes the macro
The user is now prompted for an item and amount, even though those parameters didn't exist at the start. This is because the compiler is recursive, and after a parameter is entered it goes "back to the start" and looks for more parameters!
You can also do this cunningness with file includes, let's assume we have 2 script files:
warps.txt
homes.txt
and our macro like this:
The first valid parameter found by the parser will be the list (even though file includes are processed first it won't include a file called "$$[Option[warps,homes]].txt" because it's not a valid file name in the mod's filter. So let's say you choose "warps" from the list:
Holy crap it's a valid file include! So what do we get?
Finally there's a valid warp prompt, so the user is prompted for the warp to use and chooses the "TownCentre" warp, there are no more parameters so we are left with
So why use EXEC if you can just do stuff with includes?
Well includes allow you include a lot more in a macro than would be possible with only 1 line, including the content to fill out a macro with more complex behaviour and in most cases this is what you should use. However what they don't allow you to do is "spin off" tasks which run independently of the original macro, for example if you want to run multiple background tasks then EXEC is your man. The limitation with EXEC is that it essentially builds a temporary template, known as a "spun off" template. The following EXEC builds a spun off template like this:
But because the template is spun off, it cannot collect parameters from the user.
My plan is to add a script function to bring up the prompt at a later date, so that you can for example do PROMPTFOR("town",&townvar) and have the result stored in a variable (rather than a parameter), this will allow you to do some funky stuff including putting the prompts inside IF clauses. However I need to separate the GUI code from the compiler a little bit more before this is possible, so it's a ways away yet.
Hope this helps, the reason for the rather in-depth response is I hope it may help other readers get an idea about parameters and the macro compilation process too.
EDIT: It seems I've derped in 0.8.6 when adding lists and they don't trigger recompilation like they should, I'll release a fix when I am able. For now if you use a preset parameter inside the file include with your list of choices in the preset list then it should work:
Yes I can add this.
Correct, you seem to have answered your own question
See your PM's.
KEYUP, KEYDOWN, KEY and TOGGLEKEY are "high level" and work with the minecraft Keybind class. However there are two functions in the mod which are so low that they're positively dirty. These are the PRESS and TYPE commands, these functions inject raw events into the keyboard buffer between when LWJGL polls the input devices and them being read by any other part of the game, these fake events need to be injected every tick if you want to simulate holding down a key.
The approximate order of processing is something like this:
Since I imagine that xdotools is actually injecting events into the OS buffer, you should still be able to harness the buffer manipulation functionality, but you need to inject the SHIFT key each tick for as long as you need, so for 4 ticks use
instead of the second WAIT command.
Well I don't know what brewempty.sh does, but if you're ok with shell scripting then I imagine java's not much of a challenge, I've sent you a copy of the current API via PM so you may be able to achieve what you want through that means.
This comes up a lot, it's a bug with certain java/lwjgl versions
Next, some actual scripting requests. It would be cool if we could choose a display name for list items. For instance, if I wanted to make a macro that allows me to select a chat channel to switch to, instead of having options for G, L, or T; I could make them say Global, Local, and Trade instead. These next two would mainly be used in math when it comes out. A RAND(lowerlimit, upperlimit) function could be nice, especially for aesthetic reasons (instead of repeating the exact same message every time, you could make a macro choose randomly between three or four). Also, an absolute value symbol/function would be ideal, making certain calculations a whole lot easier (example, when calculating the dimensions of an area selected with macros). Finally, It would be cool if SET() could be used on counters to set them to a specific number.
This next request would probably be very useful to people. If we had the ability to place text on different screens from macros, that would be amazing. You could a function such as TEXT(orientation, left/top/right/bottomPadding, "text", "textID", screen) to initialize it. Orientation would roughly position the text on the screen (top, left, bottom-right, for example). The four Paddings would allow for more accurate text positioning. The textID would be a unique identifier for that specific piece of text, for use in other functions. Screen would set what screen the text would be displayed on (example: options, chat, signedit, etc.) and could be left blank for it to always be displayed. Then an EDITTEXT("textID", "newText") function would be used to change what a specific section of text says. Finally, DELTEXT("textID") would be used to completely remove the text section. I'm not entirely sure if this one would be possible without changing base classes, but it would be immensely useful.
Finally, and I am fairly sure that this can't be done, but I thought I would put it up just in case. Could we access exterior programs in-game? Like, say I wanted to make a macro that would skip the song I'm currently playing in Windows Media Player. I know that WMP has an API for this kind of thing (I think that's the correct term), as Rainmeter plugins can interface with it, but I don't know if it is possible to do it from Minecraft/Java.
Wow, that's a lot of text. Also, the newest version looks epic, and I can't wait for bukkit/my server to update to 1.2.4 so I can play around with it. As always, thanks for this most awesome of mods.
I believe you mentioned it in one of the vids.
Edit: Nvm, found it, the readme was kind of hidden :x
I began minecraft ~July 7 2011 1.7.3 Beta
My username used to be Creative_Dalek but is now Dalek since 2/4/2015
Can anyone help?
Here is a code for this:
Macro/Keybind mod Wiki
With LSHIFT
With SPRINT()
Anyone?
So this makes the chat history last a lot longer, wanna make one to allow post counts from what they are to 1k(or higher)? xD
Idc if it kicks you for 5 posts in a row, I want it ._.
I began minecraft ~July 7 2011 1.7.3 Beta
My username used to be Creative_Dalek but is now Dalek since 2/4/2015
I don't see that, which is the problem. But I installed modloader before installing this mod, and I did everything it says to do in the instructions.
Right now this only works for messages in the default format of "<somename> hey guys"
Edit: changed code to make the two matches work on their own, instead of the second match relying on the first
so <Glasher143> help, my dog needs ironing
becomes
Glasher143 and help, my dog needs ironing
Now, trying to expand this to save the last message, whisper, and server broadcast..., i've run into a problem
how can i check whether the match is successful?, can i?
I tried checking if the variable it matches to has changed, but i think i'm using IF wrong
I looked through the readme on how to use an IF, and it didn't help =(
*i probably should've used one IF with 2 checks, i always forget that's possible, but i'm pretty sure that's not important right now
'Cause tomorrow spring is here