Just got back from vacation, downloaded and installed the chatfilter and damn if its not great! I can finally make chat usable where as an admin I can see what I need to see, block what I dont care to see, log AND block what I want to look at later
Thanks for all of your hard work on this!
I have tried so very long to make it that when I press w I start sprinting, and when I let go of it I stop sprinting but I can't seem to get it. If anyone knows how to do this please let me know. the hard part is that it like overlaps with normal forward key and I don't know how to make it so I don't have to press any other buttons besides w.
I know what you're saying, but any behaviour you're seeing as a result of using the incorrect methods is resulting from a bug or quirk in the way minecraft handles the key bindings and is not by design, therefore I won't add support for it because it's not good to encourage use of bugs - they may or may not be removed or fixed without notice.
I already said above that I will add support for passing variables into those functions so why is this still an issue? I didn't post all that information above to be obstructive, it's just the way Minecraft works and I was trying to explain it clearly (since there are literally zero sources anywhere else on the web that will provide this info) because without reading the Minecraft source it's hard to grasp.
So, yes to adding support for var passing, but no to adding any kind of support for controlling trigger keys with stateful commands.
Well that's good and bad to know.
Would it be possible for you to add functions similar to KEYDOWN and KEYUP that are designed for trigger events? Because the whole looping every 100ms thing dose NOT work correctly. Even looping every 1ms fails to eat or to draw a bow, and anything below ~200 is far faster than you would normally place blocks. In fact the only way to get it to draw my bow is to run two of them at the same time. The effect of holding down the use key is very useful, but aside from my work around, there seems to be no way of simulating it.
I have tried so very long to make it that when I press w I start sprinting, and when I let go of it I stop sprinting but I can't seem to get it. If anyone knows how to do this please let me know. the hard part is that it like overlaps with normal forward key and I don't know how to make it so I don't have to press any other buttons besides w.
Add this to your W key as a key state macro, under keydown:
$${keydown(forward);sprint();}$$
And under "options" check "always override conflicting key bindings". And it should work.
I'm making a macro that auto-feeds me with baked potatoes when my health gets under 14. I am trying to set the inventory slot so that it goes back to the original item held when done eating, but the slot stays the same as the food! Any fix?
Man, the looping works correctly, you just can't put any waits in there as the loop itself takes one tick and you have to call the key every tick for it to work for things that require holding it.
DO(35);
KEY(use);
LOOP;
That would eat one piece of food as it takes 1.5 seconds to eat and there are 20 ticks in a second.
For placing blocks and the like I know what you're saying but that's how Minecraft handles trigger keys so that you don't accidentally spam blocks everywhere. Minecraft itself does the waits between the actions there, other uses of use key work like that loop. In a macro that's not necessary as you can call exactly one key use accurately and only get one block placed. If you need different functionality for different actions you need to make different macros. Not really much else to it. Besides, only block placement works differently, everything else works with the loop like it should.
EDIT: Actually throwable things also works sparingly but the reason is same as block placement.
Attack key has similar things as holding it is meant for mining and clicking single times meant for attacking. That's why they are trigger keys.
In my case I need it to function exactly like the normal click/hold, while doing some other stuff. I get that it isn't the same as, say, walking forward. However it is possible to hold the key and let MC handle it normally, that is what I want. I want to let MC handle it, in all cases, as normal.
Yeah, that's the only way to get it to work like it does normally. You are replacing your normal keys with macros?
Well, somewhat. Basically I am creating an extra set of functionality on top of normal actions, so I need the original actions to function as they always would, under any case that they need to.
Now I get the the way I have found, while functional, is not supposed to work. This is why I ask: Can a feature that dose it the right way be added?
The Meaning of Life, the Universe, and Everything.
Join Date:
9/11/2012
Posts:
83
Location:
地獄
Minecraft:
________
Member Details
Well I finally fixed the sound issue. I just put the contents of the standard 'com' folder inside the 'com' folder that came with the mod, and it worked
It is supposed to work like that really. I don't think there is any other "right" way to do it besides having a virtual keybinding that wouldn't have to be on your keyboard and you can configure that in MC's config file manually. Minecraft only supports single keybindings for actions so unless you could bind more than one key for an action the way you have done it is the easiest and basically only way to get the normal functionality without excessive macros.
These kind of problems are one reason to not replace your normal keys with macros. I still have keys open for bindings on my keyboard and will keep normal keys like they are. Except I changed sneak to control because shift+F3 and some other uses of shift. I have a macro for planting crops and the like but it doesn't require me to hold any buttons and I only need to move around. It is faster than the normal holding of right click and removes the unnecessary calls for use so that no accidents happen like flipping levers if you hold the button.
Are you trying to troll him? I don't think you are fully understanding what he is trying to say and you've made a simple yes I can add this to the mod into a 3 page post between you two arguing.
Are you trying to troll him? I don't think you are fully understanding what he is trying to say and you've made a simple yes I can add this to the mod into a 3 page post between you two arguing.
Ya, I'm not really sure what the intention is here, I'm just trying to make a feature request. I'm not asking for something impossible. Why are we arguing over it?
I've been using this for quite some time now and I love the button GUI. I've decided to share my configuraton here. It's custom made for servers where you've got creative mode, WorldEdit, WorldGuard, Commandbook, VanishNoPacket and MultiVerse.
The WorldEdit wand is bound to Ctrl + Left click and Ctrl + Right click.
It's got WorldEdit keyboard shortcuts, including WYSIWIG selection editing if you've got WorldEdit CUI. The arrow keys and PgUp/PgDn expands your selection, or contracts it if you hold shift. Hold Ctrl to make the action go 10 times as far. Home and End outsets and insets.
It's also got a custom script that defines a region in WorldGuard using your WorldEdit selection. And sets the owner and some flags.
And it's got a custom button GUI containing a lot of the commands I use.
I suggest downloading my configuration if you'd like to use this mod with some of the plugins mentioned above, or as a starting point to make your own customizations and scripts for this mod.
The Meaning of Life, the Universe, and Everything.
Location:
Somewhere between neurons
Join Date:
9/16/2011
Posts:
48
Location:
What's a "world"?
Minecraft:
BrickViking
Member Details
Could I ask a polite question here? My wife has been finding that the time for a double click (for example, of the right mouse button) is far too short for her. Is there any way of lengthening that out? From what I can tell, the time before a button-down is considered multiple is about 150ms or thereabouts. I'm trying to extend that out to perhaps 400ms before minecraft considers that it's a double-click. What options do I have?
To clarify, I'm using mod_macros 0.9.3 (for 1.3.2), though I will be upgrading to 0.9.5 for 1.4.2 soon.
What if I wanted the normal functionality where it is not disabled but it doesn't show up either? And doing shift+F3 would show it. I mean, the debug profiler's pie chart and graph does not show up without shift in F3 normally now and LiteLoader doesn't force them to show up without OptiFine. I know you want it to be forced but why do the graphs have to show up when they don't without OptiFine?
The showing/hiding the graph is not coupled to the profiler's enabled status. The Profiler object itself within Minecraft is a perfect candidate for hooking because it gets called reliablly at multiple points in the tick cycle, and allows LiteLoader to dynamically intercept those calls to use as events internally. Under normal circumstances the profiler cannot be "unhooked" so it gets called all the time regardless of whether it's doing any profiling. As an optimisation, Mojang added code a while ago to support only getting the profiler to actually DO anything when required, but it doesn't get unhooked, the Profiler itself just chooses to do no work. This means in the vanilla setup, the Profiler is still a perfect candidate for event callbacks since it's being called all the time regardless, and has no performance overhead because it only does actual profiling when needed.
Enter Optifine. Before Mojang added their optimisation, Optifine worked around the profiler being a huge resource drain by "unhooking" the profiler so that it didn't get called, and added the option to the config screen. It also replaced Mojang's debug screen with its own. Since Mojang added their optimisation, the unhooking is no longer needed but is still kept there, and as a side effect you can now no longer use the optimisation that Mojang added, and works in a more sensible way. So until Optifine catches up and removes its outdated method, unfortunately it's stuck like this.
Would it be possible for you to add functions similar to KEYDOWN and KEYUP that are designed for trigger events?
It's possible, but it's far from trivial for a number of reasons. I won't be adding support for trigger bindings to KEYUP and KEYDOWN, but I *might* add some lower-level commands of the order of PRESS and TYPE that can simulate key up and key down at a lower level.
See, it's hard at times to know where to pitch functionality in terms of how far removed it is from the game mechanics. In general I tend to err on the side of making the commands fairly "raw" since it gives users the most control, but always add a layer of cotton wool so that in theory macros can't affect the state of the game in a way that ordinary interaction couldn't.
The different commands that are there exist to complement and provide access to the different underlying concepts of the key bindings, and while this may seem non-sensical because holding down a key is such a simple concept and why should it be so hard, the reality is that it's a complex system underlying the game and interacting with it needs an appropriate, scaled level of complexity so that the user can appreciate what they are doing and work smarter because of it. I provided that lengthy explanation above so that you could hopefully gain a better understanding of what's going on under the bonnet and see where the difficulties lie.
Now, admittedly there are some much higher-level commands in the mod which clearly don't share this 1-to-1 relationship with underlying concepts. CRAFT is the perfect example since it's a wrapper around an entire sub-system of functionality within the mod core, and under normal circumstances that one function could be considered a mod in its own right! But SLOTCLICK, GETSLOT, GETISLOTTEM and GUI still exist, and these are the low-level mappings against the concepts which would allow the creation of complex behaviour (even as complex as CRAFT), they still exist and are still usable. Now in this situation the case is that the "high level" function doesn't exist yet, I would need to write it, and just like CRAFT that is far from straightforward and all I really want is some understanding from you that it's not as simple as just bolting some tiny add-on onto KEYUP and KEYDOWN to support this.
Development of CRAFT took weeks, I've just spent the last few dealing with the (what would appear to the outside observer to be simple) situation with being able to use the slot manipulation functions in the creative GUI, and what you're asking is a similar proposition. So whilst I can add it to the wish list, it's just not feasible in the short term especially factoring in that you can already do what you want using existing mechanisms.
Besides, only block placement works differently, everything else works with the loop like it should.
EDIT: Actually throwable things also works sparingly but the reason is same as block placement.
It does this derpy behaviour because of a quirk in the way minecraft detects events, this is why I won't support it because it could be removed at any time if they spot the mistake.
In my case I need it to function exactly like the normal click/hold, while doing some other stuff. I get that it isn't the same as, say, walking forward. However it is possible to hold the key and let MC handle it normally, that is what I want. I want to let MC handle it, in all cases, as normal.
Can you not achieve this by putting the complex behaviour in the KEY DOWN handler and just putting $${KEY(use)}$$ in the KEY HELD handler with a repeat of 1 ticks?
Could I ask a polite question here? My wife has been finding that the time for a double click (for example, of the right mouse button) is far too short for her. Is there any way of lengthening that out? From what I can tell, the time before a button-down is considered multiple is about 150ms or thereabouts. I'm trying to extend that out to perhaps 400ms before minecraft considers that it's a double-click. What options do I have?
To clarify, I'm using mod_macros 0.9.3 (for 1.3.2), though I will be upgrading to 0.9.5 for 1.4.2 soon.
Regards, The Viking (Dr Smokey)
(Post 19)
I'll help if I can, could you provide some more detail? The only things I know of in minecraft that require "double tap" of a key are sprint and fly, so I'll talk about those. If I've missed some other usage then I apologise but the info might still be relevant.
Unfortunately since Minecraft interacts with the input system in a fairly uncomplicated manner, it doesn't have a concept of a "double-click" as a discrete event; instead anything requiring double press is handled internally with timers by monitoring the state of keys and using a timer to count the elapsed time between key presses. This is the bad news, since it effectively means there's no single source to define a "double-click" duration, and these timer amounts are hard-coded and can't be changed without modifying the relevant classes.
That's the bad news, the good news is that you can use this mod to simulate a double click with some simple scripting, and depending what you want to do this is either simple or outstandingly simple:
The outstandingly simple scenario is if you want to activate sprinting, you can simply do this by binding a key to
$${SPRINT}$$
and sprint will be activated.
For simulating double click of the "jump" key (for flight), you can use:
which simulates pressing jump twice in quick succession. Note that we use the binding name "jump" to activate the binding, not the name of the key itself.
Coupled with the override feature, this can be quite useful. The OVERRIDE key defaults to CTRL, so if you bound the first macro to W, then pressing CTRL+W would be sufficient to activate sprint, and the same with the second macro on SPACE.
If I've missed something here then let me know, I'm not sure about the example you gave since right-click defaults to USE and I don't know of any part of the game that requires USE to be double-clicked.
Hope this helps, I can probably provide some better info if you can supply some more detail on what you're trying to do.
Good grief, I'm busy for a couple of days doing updates and come back to defense condition 1 between two thread regulars.
[snip]
It's possible, but it's far from trivial for a number of reasons. I won't be adding support for trigger bindings to KEYUP and KEYDOWN, but I *might* add some lower-level commands of the order of PRESS and TYPE that can simulate key up and key down at a lower level.
See, it's hard at times to know where to pitch functionality in terms of how far removed it is from the game mechanics. In general I tend to err on the side of making the commands fairly "raw" since it gives users the most control, but always add a layer of cotton wool so that in theory macros can't affect the state of the game in a way that ordinary interaction couldn't.
The different commands that are there exist to complement and provide access to the different underlying concepts of the key bindings, and while this may seem non-sensical because holding down a key is such a simple concept and why should it be so hard, the reality is that it's a complex system underlying the game and interacting with it needs an appropriate, scaled level of complexity so that the user can appreciate what they are doing and work smarter because of it. I provided that lengthy explanation above so that you could hopefully gain a better understanding of what's going on under the bonnet and see where the difficulties lie.
[snip]
Development of CRAFT took weeks, I've just spent the last few dealing with the (what would appear to the outside observer to be simple) situation with being able to use the slot manipulation functions in the creative GUI, and what you're asking is a similar proposition. So whilst I can add it to the wish list, it's just not feasible in the short term especially factoring in that you can already do what you want using existing mechanisms.
So, added to wish list.
[snip
Can you not achieve this by putting the complex behaviour in the KEY DOWN handler and just putting $${KEY(use)}$$ in the KEY HELD handler with a repeat of 1 ticks?
See above, the short answer is "yes, but not in the near term".
Ya, sorry about the arguing, not sure where either of us though that was going (Thanks Sniper for calling us on it).
Anyway, I understand it isn't simple, my point is that the only way to do it now has a great many failing. Which lads into the $${KEY(use)}$$ on keyheld. This might work in theory, but depending on the timing it either hits too fast (block spam) or too slow (can't eat/draw a bow). Since I need it to act normally reguardless of what item I am using I would need multiple files, each with a different loop delay, that would be called conditionally depending on what item is held. And the script would need updated any time a new item (like new food) were to be added. All this to recreate an effect that MC already dose.
Or am I missing something with the timing? Everyone automatically started replying with loops, with various delays (or none at all), but none of them seem to work the way I need. But, I guess I could be missing some point.
Also, anyone else takiing a framerate hit from loops? Those use loops all seem to lag me, and any loops that update the GUI seem to cause a LOT of framrate loss. I have a loop that simply updates a label with my cooridinates constantly, and I keep getting huge down spikes in framerate, but if I kill the loop things go back to normal. I don't see why this would be, pleanty of stuff on screen updates way faster than that, and all it dose is set the label with the X/Y/ZPOS variables in it.
It's possible, but it's far from trivial for a number of reasons. I won't be adding support for trigger bindings to KEYUP and KEYDOWN, but I *might* add some lower-level commands of the order of PRESS and TYPE that can simulate key up and key down at a lower level.
See, it's hard at times to know where to pitch functionality in terms of how far removed it is from the game mechanics. In general I tend to err on the side of making the commands fairly "raw" since it gives users the most control, but always add a layer of cotton wool so that in theory macros can't affect the state of the game in a way that ordinary interaction couldn't.
The different commands that are there exist to complement and provide access to the different underlying concepts of the key bindings, and while this may seem non-sensical because holding down a key is such a simple concept and why should it be so hard, the reality is that it's a complex system underlying the game and interacting with it needs an appropriate, scaled level of complexity so that the user can appreciate what they are doing and work smarter because of it. I provided that lengthy explanation above so that you could hopefully gain a better understanding of what's going on under the bonnet and see where the difficulties lie.
Okay, i went back 10 - 15 posts in this discussion but i couldn't find an answer...
If minecraft only detects whether the "use" (or "attack") key is down or not, why doesn't DO;KEY();LOOP work the same as holding down?
Isn't it essentially always down?
Which lads into the $${KEY(use)}$$ on keyheld. This might work in theory, but depending on the timing it either hits too fast (block spam) or too slow (can't eat/draw a bow).
Setting the delay to 1 makes it call KEY every tick though, this is the essential difference between trigger bindings and stateful bindings, in that "held down" for them is an event every tick rather than a single "held down" flag, that's why if you put them inside a DO..LOOP there cannot be any delay, if there is even a single dropped tick then Minecraft will perceive a RELEASE/PRESS event which as you've seen produces some wild results.
Or am I missing something with the timing? Everyone automatically started replying with loops, with various delays (or none at all), but none of them seem to work the way I need. But, I guess I could be missing some point.
$${DO;KEY(use);LOOP}$$
Will always work to "hold down" a trigger binding. Anything else in the loop and MC will perceive multiple presses not a continuous press.
Also, anyone else takiing a framerate hit from loops? Those use loops all seem to lag me, and any loops that update the GUI seem to cause a LOT of framrate loss. I have a loop that simply updates a label with my cooridinates constantly, and I keep getting huge down spikes in framerate, but if I kill the loop things go back to normal. I don't see why this would be, pleanty of stuff on screen updates way faster than that, and all it dose is set the label with the X/Y/ZPOS variables in it.
I struggle with this because I develop on a 3.4GHz i7 so it takes a lot to produce a framerate hit for me, but I do also test on the crappiest PC I own (an ancient Core 2 Duo) and the performance is still very good. Loops and conditions are intrinsically efficient in that each LOOP and ENDIG command suspends the macro for 1 tick and you can run hundreds of simultaneous loops before you should see a performance hit. Labels on the other hand are not efficient because they are necessarily decoupled from the script engine by nature (since they are visible all the time but the script engine may not be active), this means setting them from script is an expensive operation. This is the reason for bindings, using a label binding allows the label to update dynamically but much more efficiently since it can locate the source of information just once and then use that every frame. Every time you call SETLABEL you force the label to detach from the current binding and re-bind with the new format.
For this reason setting a label to just "%%", setting the binding to a global variable, then using a script to update the global variable is way more efficient than calling SETLABEL every tick. You'd need a lot of labels before the performance hit was even measurable. However using 3 labels bound to each variable directly is even more efficient than running a script at all.
Okay, i went back 10 - 15 posts in this discussion but i couldn't find an answer...
If minecraft only detects whether the "use" (or "attack") key is down or not, why doesn't DO;KEY();LOOP work the same as holding down?
Isn't it essentially always down?
There must be a difference.., but what is it?
It's really hard to explain, the best explanation I can give was the excerpt from the wiki I posted, but I'll attempt to clarify if you can stand a bit of iternals.
For historic reasons, and mostly to do with weirdness related to accessing mouse button presses via LWJGL, each keybinding has two internal state variables. A flag indicating whether it is "pressed", and a second state variable counting every tick the key is pressed which is decremented for every time the key's pressed state is read. This second mechanism is very important because it essentially applies correction for framerate to time-sensitive operations like placing and breaking blocks.
For every key binding in the game, both of these internal flags are updated every tick, but if the framerate is different than the tick rate (which is basically true almost all of the time) the special mechanism prevents shifts in framerate from causing weird behaviour with the critical actions of ATTACK and USE. A good example of why this is needed is the "drift" problem you can get (it used to be more common) with movement where a key would appear to be "stuck" even though you weren't pressing it any more.
The reason all this is needed is that LWJGL polls the state of input devices every frame not every tick, and this is the reason the weird alignment strategy is required at all, precisely because tick rate and frame rate are decoupled from one another.
So whilst all keybindings maintain these internal state data, different aspects of the game query that information in different ways. Those which I call "momentary" bindings, only look for state change and ignore all the other data; those I call "stateful" bindings only pay attention to the pressed flag and ignore the events (stuff like movement which isn't greatly affected by frame rate slew because it's continuous). The side effects of this over-simplification is what leads to derpy effects like sprinting not activating sometimes, or activating when it shouldn't, key spam, sneak getting stuck, and other things.
"Trigger" bindings however use this extra information (the pressed ticks count) to adjust for frame rate slew and only trust the "pressed" state if it is generated by a legitimate ticked mousedown event, ensuring that it always takes a deterministic amount of time to break a block, and provide debounce for placing blocks if framerate dips too low. The "bug" here is that the leading-edge detection of these bindings can be triggered by the "pressed" flag which would normally only be set when a legitimate tick key press is received but Macros allows you to set independently using the KEYDOWN command for certain supported keys. What happens if you send a KEYDOWN to a trigger key is that the leading edge gets triggered (because it's read through the same mechanism as the tick counter) but the follow-up (essentially verifying that key was actually down) doesn't succeed leading to the "momentary" aspect of the key bind activating (hence why placing blocks gets triggered once) but the bind is not considered held down because it's not recieving any more ticks.
It should be clear from this that the only sensible way to activate a "trigger" binding is by incrementing the counter every game tick to simulate 1 tick worth of held down. To provide a KEYDOWN-like support for this I'd need to write a new subsystem which could handle generation of these fake events when required, and could be toggled on and off as needed by new script commands.
Hope that answers the question and wasn't too technical.
Thanks for all of your hard work on this!
Well that's good and bad to know.
Would it be possible for you to add functions similar to KEYDOWN and KEYUP that are designed for trigger events? Because the whole looping every 100ms thing dose NOT work correctly. Even looping every 1ms fails to eat or to draw a bow, and anything below ~200 is far faster than you would normally place blocks. In fact the only way to get it to draw my bow is to run two of them at the same time. The effect of holding down the use key is very useful, but aside from my work around, there seems to be no way of simulating it.
Add this to your W key as a key state macro, under keydown:
And under "options" check "always override conflicting key bindings". And it should work.
A server.log.lck generates too, but it disappears when Minecraft closes.
Anyone have any idea how to fix this?
EXEC needs a file AND a name.
use %INVSLOT% instead of %invslot%
Macro/Keybind mod Wiki
In my case I need it to function exactly like the normal click/hold, while doing some other stuff. I get that it isn't the same as, say, walking forward. However it is possible to hold the key and let MC handle it normally, that is what I want. I want to let MC handle it, in all cases, as normal.
Well, somewhat. Basically I am creating an extra set of functionality on top of normal actions, so I need the original actions to function as they always would, under any case that they need to.
Now I get the the way I have found, while functional, is not supposed to work. This is why I ask: Can a feature that dose it the right way be added?
Click Here To Check Out The Server Forums
Server IP: play.pokemonserver.net
Are you trying to troll him? I don't think you are fully understanding what he is trying to say and you've made a simple yes I can add this to the mod into a 3 page post between you two arguing.
Ya, I'm not really sure what the intention is here, I'm just trying to make a feature request. I'm not asking for something impossible. Why are we arguing over it?
The WorldEdit wand is bound to Ctrl + Left click and Ctrl + Right click.
It's got WorldEdit keyboard shortcuts, including WYSIWIG selection editing if you've got WorldEdit CUI. The arrow keys and PgUp/PgDn expands your selection, or contracts it if you hold shift. Hold Ctrl to make the action go 10 times as far. Home and End outsets and insets.
It's also got a custom script that defines a region in WorldGuard using your WorldEdit selection. And sets the owner and some flags.
And it's got a custom button GUI containing a lot of the commands I use.
I suggest downloading my configuration if you'd like to use this mod with some of the plugins mentioned above, or as a starting point to make your own customizations and scripts for this mod.
Download the configuration files here (use the download button on the top right):
https://www.dropbox....zhj3/4LlltsLG5o
To clarify, I'm using mod_macros 0.9.3 (for 1.3.2), though I will be upgrading to 0.9.5 for 1.4.2 soon.
Regards, The Viking (Dr Smokey)
(Post 19)
Cheers, The Viking (Dr Smokey)
Image Removed
The showing/hiding the graph is not coupled to the profiler's enabled status. The Profiler object itself within Minecraft is a perfect candidate for hooking because it gets called reliablly at multiple points in the tick cycle, and allows LiteLoader to dynamically intercept those calls to use as events internally. Under normal circumstances the profiler cannot be "unhooked" so it gets called all the time regardless of whether it's doing any profiling. As an optimisation, Mojang added code a while ago to support only getting the profiler to actually DO anything when required, but it doesn't get unhooked, the Profiler itself just chooses to do no work. This means in the vanilla setup, the Profiler is still a perfect candidate for event callbacks since it's being called all the time regardless, and has no performance overhead because it only does actual profiling when needed.
Enter Optifine. Before Mojang added their optimisation, Optifine worked around the profiler being a huge resource drain by "unhooking" the profiler so that it didn't get called, and added the option to the config screen. It also replaced Mojang's debug screen with its own. Since Mojang added their optimisation, the unhooking is no longer needed but is still kept there, and as a side effect you can now no longer use the optimisation that Mojang added, and works in a more sensible way. So until Optifine catches up and removes its outdated method, unfortunately it's stuck like this.
If you compare a variable with a string literal, the string needs to be quoted since IF treats all its arguments like variables otherwise:
It's possible, but it's far from trivial for a number of reasons. I won't be adding support for trigger bindings to KEYUP and KEYDOWN, but I *might* add some lower-level commands of the order of PRESS and TYPE that can simulate key up and key down at a lower level.
See, it's hard at times to know where to pitch functionality in terms of how far removed it is from the game mechanics. In general I tend to err on the side of making the commands fairly "raw" since it gives users the most control, but always add a layer of cotton wool so that in theory macros can't affect the state of the game in a way that ordinary interaction couldn't.
The different commands that are there exist to complement and provide access to the different underlying concepts of the key bindings, and while this may seem non-sensical because holding down a key is such a simple concept and why should it be so hard, the reality is that it's a complex system underlying the game and interacting with it needs an appropriate, scaled level of complexity so that the user can appreciate what they are doing and work smarter because of it. I provided that lengthy explanation above so that you could hopefully gain a better understanding of what's going on under the bonnet and see where the difficulties lie.
Now, admittedly there are some much higher-level commands in the mod which clearly don't share this 1-to-1 relationship with underlying concepts. CRAFT is the perfect example since it's a wrapper around an entire sub-system of functionality within the mod core, and under normal circumstances that one function could be considered a mod in its own right! But SLOTCLICK, GETSLOT, GETISLOTTEM and GUI still exist, and these are the low-level mappings against the concepts which would allow the creation of complex behaviour (even as complex as CRAFT), they still exist and are still usable. Now in this situation the case is that the "high level" function doesn't exist yet, I would need to write it, and just like CRAFT that is far from straightforward and all I really want is some understanding from you that it's not as simple as just bolting some tiny add-on onto KEYUP and KEYDOWN to support this.
Development of CRAFT took weeks, I've just spent the last few dealing with the (what would appear to the outside observer to be simple) situation with being able to use the slot manipulation functions in the creative GUI, and what you're asking is a similar proposition. So whilst I can add it to the wish list, it's just not feasible in the short term especially factoring in that you can already do what you want using existing mechanisms.
So, added to wish list.
Update to the latest version of LiteLoader.
It does this derpy behaviour because of a quirk in the way minecraft detects events, this is why I won't support it because it could be removed at any time if they spot the mistake.
Can you not achieve this by putting the complex behaviour in the KEY DOWN handler and just putting $${KEY(use)}$$ in the KEY HELD handler with a repeat of 1 ticks?
See above, the short answer is "yes, but not in the near term".
Awesome work dude, thank you for sharing.
Not sure, what are you attempting to do? Theoretically it should set it to 1 if it's zero and CTRL was not pressed when invoking the macro.
I'll help if I can, could you provide some more detail? The only things I know of in minecraft that require "double tap" of a key are sprint and fly, so I'll talk about those. If I've missed some other usage then I apologise but the info might still be relevant.
Unfortunately since Minecraft interacts with the input system in a fairly uncomplicated manner, it doesn't have a concept of a "double-click" as a discrete event; instead anything requiring double press is handled internally with timers by monitoring the state of keys and using a timer to count the elapsed time between key presses. This is the bad news, since it effectively means there's no single source to define a "double-click" duration, and these timer amounts are hard-coded and can't be changed without modifying the relevant classes.
That's the bad news, the good news is that you can use this mod to simulate a double click with some simple scripting, and depending what you want to do this is either simple or outstandingly simple:
The outstandingly simple scenario is if you want to activate sprinting, you can simply do this by binding a key to
and sprint will be activated.
For simulating double click of the "jump" key (for flight), you can use:
which simulates pressing jump twice in quick succession. Note that we use the binding name "jump" to activate the binding, not the name of the key itself.
Coupled with the override feature, this can be quite useful. The OVERRIDE key defaults to CTRL, so if you bound the first macro to W, then pressing CTRL+W would be sufficient to activate sprint, and the same with the second macro on SPACE.
If I've missed something here then let me know, I'm not sure about the example you gave since right-click defaults to USE and I don't know of any part of the game that requires USE to be double-clicked.
Hope this helps, I can probably provide some better info if you can supply some more detail on what you're trying to do.
Ya, sorry about the arguing, not sure where either of us though that was going (Thanks Sniper for calling us on it).
Anyway, I understand it isn't simple, my point is that the only way to do it now has a great many failing. Which lads into the $${KEY(use)}$$ on keyheld. This might work in theory, but depending on the timing it either hits too fast (block spam) or too slow (can't eat/draw a bow). Since I need it to act normally reguardless of what item I am using I would need multiple files, each with a different loop delay, that would be called conditionally depending on what item is held. And the script would need updated any time a new item (like new food) were to be added. All this to recreate an effect that MC already dose.
Or am I missing something with the timing? Everyone automatically started replying with loops, with various delays (or none at all), but none of them seem to work the way I need. But, I guess I could be missing some point.
Also, anyone else takiing a framerate hit from loops? Those use loops all seem to lag me, and any loops that update the GUI seem to cause a LOT of framrate loss. I have a loop that simply updates a label with my cooridinates constantly, and I keep getting huge down spikes in framerate, but if I kill the loop things go back to normal. I don't see why this would be, pleanty of stuff on screen updates way faster than that, and all it dose is set the label with the X/Y/ZPOS variables in it.
Anyway, thanks for adding it to the list.
Okay, i went back 10 - 15 posts in this discussion but i couldn't find an answer...
If minecraft only detects whether the "use" (or "attack") key is down or not, why doesn't DO;KEY();LOOP work the same as holding down?
Isn't it essentially always down?
There must be a difference.., but what is it?
'Cause tomorrow spring is here
I bound this script to f. When I hit f normally, it does nothing, but when I hit f again it turns into 0 twice.
But it is fine when I hit ctrl and f. I don't understand! D:
Setting the delay to 1 makes it call KEY every tick though, this is the essential difference between trigger bindings and stateful bindings, in that "held down" for them is an event every tick rather than a single "held down" flag, that's why if you put them inside a DO..LOOP there cannot be any delay, if there is even a single dropped tick then Minecraft will perceive a RELEASE/PRESS event which as you've seen produces some wild results.
Will always work to "hold down" a trigger binding. Anything else in the loop and MC will perceive multiple presses not a continuous press.
I struggle with this because I develop on a 3.4GHz i7 so it takes a lot to produce a framerate hit for me, but I do also test on the crappiest PC I own (an ancient Core 2 Duo) and the performance is still very good. Loops and conditions are intrinsically efficient in that each LOOP and ENDIG command suspends the macro for 1 tick and you can run hundreds of simultaneous loops before you should see a performance hit. Labels on the other hand are not efficient because they are necessarily decoupled from the script engine by nature (since they are visible all the time but the script engine may not be active), this means setting them from script is an expensive operation. This is the reason for bindings, using a label binding allows the label to update dynamically but much more efficiently since it can locate the source of information just once and then use that every frame. Every time you call SETLABEL you force the label to detach from the current binding and re-bind with the new format.
For this reason setting a label to just "%%", setting the binding to a global variable, then using a script to update the global variable is way more efficient than calling SETLABEL every tick. You'd need a lot of labels before the performance hit was even measurable. However using 3 labels bound to each variable directly is even more efficient than running a script at all.
It's no problem.
It's really hard to explain, the best explanation I can give was the excerpt from the wiki I posted, but I'll attempt to clarify if you can stand a bit of iternals.
For historic reasons, and mostly to do with weirdness related to accessing mouse button presses via LWJGL, each keybinding has two internal state variables. A flag indicating whether it is "pressed", and a second state variable counting every tick the key is pressed which is decremented for every time the key's pressed state is read. This second mechanism is very important because it essentially applies correction for framerate to time-sensitive operations like placing and breaking blocks.
For every key binding in the game, both of these internal flags are updated every tick, but if the framerate is different than the tick rate (which is basically true almost all of the time) the special mechanism prevents shifts in framerate from causing weird behaviour with the critical actions of ATTACK and USE. A good example of why this is needed is the "drift" problem you can get (it used to be more common) with movement where a key would appear to be "stuck" even though you weren't pressing it any more.
The reason all this is needed is that LWJGL polls the state of input devices every frame not every tick, and this is the reason the weird alignment strategy is required at all, precisely because tick rate and frame rate are decoupled from one another.
So whilst all keybindings maintain these internal state data, different aspects of the game query that information in different ways. Those which I call "momentary" bindings, only look for state change and ignore all the other data; those I call "stateful" bindings only pay attention to the pressed flag and ignore the events (stuff like movement which isn't greatly affected by frame rate slew because it's continuous). The side effects of this over-simplification is what leads to derpy effects like sprinting not activating sometimes, or activating when it shouldn't, key spam, sneak getting stuck, and other things.
"Trigger" bindings however use this extra information (the pressed ticks count) to adjust for frame rate slew and only trust the "pressed" state if it is generated by a legitimate ticked mousedown event, ensuring that it always takes a deterministic amount of time to break a block, and provide debounce for placing blocks if framerate dips too low. The "bug" here is that the leading-edge detection of these bindings can be triggered by the "pressed" flag which would normally only be set when a legitimate tick key press is received but Macros allows you to set independently using the KEYDOWN command for certain supported keys. What happens if you send a KEYDOWN to a trigger key is that the leading edge gets triggered (because it's read through the same mechanism as the tick counter) but the follow-up (essentially verifying that key was actually down) doesn't succeed leading to the "momentary" aspect of the key bind activating (hence why placing blocks gets triggered once) but the bind is not considered held down because it's not recieving any more ticks.
It should be clear from this that the only sensible way to activate a "trigger" binding is by incrementing the counter every game tick to simulate 1 tick worth of held down. To provide a KEYDOWN-like support for this I'd need to write a new subsystem which could handle generation of these fake events when required, and could be toggled on and off as needed by new script commands.
Hope that answers the question and wasn't too technical.
Ok that's bloody weird, I'll check it out.