one last question, is there a difference between doing
$$<script.txt>
and
exec $$<script.txt>
inside another script?
exec $$<script.txt> is invalid code, what you mean is Exec(script.txt)
when you use $$<script.txt>, the mod reads over the script first, finds that pattern "called a file include", deletes it and blindly pastes the entire contents of the file in it's place
once all $$<>'s and $$?'s have been replaced, only then is the script actually run, and it all acts as if it had been written into one file, one binding
when you use Exec(script.txt), that is only triggered once the script reaches that point (as opposed to before the script even starts running.., it creates a new process that runs independently of the current one, the new one running the code in the file (script tags not necessary), and both processes run separately, not waiting for eachother
Exec'd processes also have their own separate local variables
Usually you don't want to use Exec.., Exec is mainly only if you need asynchronous processes (two things running at the same time doing different things)
As an actual example, imagine file one is
$<file2.txt>
For(#i,1,10)
Log(%#i%)
Loop
And file 2 is
For(#i,11,20)
Log(%#i%)
Loop
If you run file one, the output will be:
11,12,13...19,20,1,2,3,...,8,9,10
If the file include was an Exec(file2.txt), you might see something like this instead:
11,1,2,12,13,3,14,4,15,5,6,16
I have noticed since the 1.6 release of Macro Keybind has finally breached my sanity. After mining a lot on a prison server, I wanted to auto-craft ores and redstone into blocks. Fair enough, I head to a crafting table, set up a macro, and it doesn't work. After extensive SSP testing, I have found the problem. It appears that ever since block IDs have been changed to full names, anything with underscores is somehow bugging out. I can craft basic items perfectly fine, such as redstone, pistons, and doors. However, I can not craft items such as redstone_block, diamond_block, flint_and_steel, etc.
Thank you, Mumfrey, for updating Macro Keybind to a beta 1.7.10 version, as well as your fantastic work on LiteLoader.
I have noticed since the 1.6 release of Macro Keybind has finally breached my sanity. After mining a lot on a prison server, I wanted to auto-craft ores and redstone into blocks. Fair enough, I head to a crafting table, set up a macro, and it doesn't work. After extensive SSP testing, I have found the problem. It appears that ever since block IDs have been changed to full names, anything with underscores is somehow bugging out. I can craft basic items perfectly fine, such as redstone, pistons, and doors. However, I can not craft items such as redstone_block, diamond_block, flint_and_steel, etc.
Thank you, Mumfrey, for updating Macro Keybind to a beta 1.7.10 version, as well as your fantastic work on LiteLoader.
Have you tried wrapping the string in quotes?, it's optional sometimes, but when special characters break your script (such as if you need to put parentheses inside your text), quoting it should fix it
for example, Echo("this parentheses -> ) <- is ignored by the script engine")
Pleeeeeeeeeeeeeease what does the "UNSAFE()" and "ENDUNSAFE" commands? And how I use %EFFECTNAME% or %EFFECTTIME% in a Label?
EFFECTNAME and EFFECTTIME only exist for a specific effect (what would they even be if you had many), which means you can't simply paste those on a label, you can only use them in a script inside a ForEach(effects);stuffHere;Next loop
Is here a list on the commands between two %'s post? I need them please.
They're not commands (and i'm not being pedantic, it's very important to be able to tell the difference), they're environment variables
And all the percent signs do is convert the value to a literal string (if the script isn't expecting a variable)
For example
IF(HEALTH < 20) becomes IF(20 < 20), which is what you want
IF(%HEALTH% < 20) becomes IF("20" < 20), which is not correct (comparing a string to a number is nonsense and random(ish))
however, a command like Echo expects a literal string, so in that case you need percent signs to make a string, so..
Echo(My health is HEALTH) >> "My health is HEALTH"
Echo(My health is %HEALTH%) >> My health is "20" >> "My health is 20"
so in this case you do need percent signs
In any case, commands are IF() and Echo(), %HEALTH% on it's own is meaningless, it's not an action, it's a value
Now, as for the list of them.., http://mkb.bplaced.net/#/wiki/variables
You can also run ForEach(env);Log(%VARNAME%);Next to get a list of them all, or use your own script to maybe filter some out and show values if you want, the point is you can also iterate over the names of every global variable using ForEach(env)
I'm not labelling this specifically as a pre-release because not much has changed and I'm hoping it's actually good to go, but I haven't had much time to do extensive testing so I'll leave it a day or maybe two before updating the OP, in case there are any show-stopping bugs that I've missed.
Using the 1.7.10 pre-release, I get this crash when clicking the "Controls" button in the options menu. Macros is the only mod installed. Hope I didn't mess something obvious up.
---- Minecraft Crash Report ----
// Shall we play a game?
Time: 7/17/14 12:33 AM
Description: Unexpected error
java.lang.ClassCastException: bbj cannot be cast to bes
at net.eq2online.macros.core.MacroModCore.transformKeyBindings(MacroModCore.java:759)
at net.eq2online.macros.core.MacroModCore.onRender(MacroModCore.java:735)
at net.eq2online.macros.LiteModMacros.onRender(LiteModMacros.java:86)
at com.mumfrey.liteloader.client.ClientEvents.onRender(ClientEvents.java:517)
at com.mumfrey.liteloader.client.CallbackProxyClient.onRender(CallbackProxyClient.java:153)
at bao.ak(SourceFile:800)
at bao.f(SourceFile:728)
at net.minecraft.client.main.Main.main(SourceFile:148)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- System Details --
Details:
Minecraft Version: 1.7.10
Operating System: Windows 7 (x86) version 6.1
Java Version: 1.7.0_51, Oracle Corporation
Java VM Version: Java HotSpot(TM) Client VM (mixed mode, sharing), Oracle Corporation
Memory: 15991816 bytes (15 MB) / 81502208 bytes (77 MB) up to 518979584 bytes (494 MB)
Mod Pack: Unknown / None
LiteLoader Mods: 1 loaded mod(s)
- Macro / Keybind Mod version 0.10.10
LaunchWrapper: 14 active transformer(s)
- Transformer: com.mumfrey.liteloader.transformers.event.EventProxyTransformer
- Transformer: com.mumfrey.liteloader.launch.LiteLoaderTransformer
- Transformer: com.mumfrey.liteloader.client.transformers.CrashReportTransformer
- Transformer: com.mumfrey.liteloader.client.transformers.LiteLoaderEventInjectionTransformer
- Transformer: com.mumfrey.liteloader.client.transformers.LiteLoaderCallbackInjectionTransformer
- Transformer: com.mumfrey.liteloader.client.transformers.JoinGamePacketTransformer
- Transformer: com.mumfrey.liteloader.client.transformers.ServerChatPacketTransformer
- Transformer: com.mumfrey.liteloader.client.transformers.LoginSuccessPacketTransformer
- Transformer: com.mumfrey.liteloader.client.transformers.ChatPacketTransformer
- Transformer: net.eq2online.macros.transformers.MacrosTransformer
- Transformer: net.eq2online.macros.transformers.CollectionPacketTransformer
- Transformer: com.mumfrey.liteloader.client.transformers.ServerCustomPayloadPacketTransformer
- Transformer: com.mumfrey.liteloader.client.transformers.CustomPayloadPacketTransformer
- Transformer: com.mumfrey.liteloader.client.transformers.MinecraftOverlayTransformer
JVM Flags: 2 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx512M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
Launched Version: 1.7.10
LWJGL: 2.9.1
OpenGL: Intel(R) HD Graphics Family GL version 3.0.0 - Build 8.15.10.2353, Intel
GL Caps: Using GL 1.3 multitexturing.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Anisotropic filtering is supported and maximum anisotropy is 16.
Shaders are available because OpenGL 2.1 is supported.
Is Modded: Definitely; Client brand changed to 'LiteLoader'
Type: Client (map_client.txt)
Resource Packs: []
Current Language: English (US)
Profiler Position: N/A (disabled)
Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Anisotropic Filtering: Off (1)
You did nothing wrong (unless both did wrong :p). I have LiteLoader 1.7.10_02 installed, not hooked to anything.
Only mod installed is macros:
Logfile:
Description: Unexpected error
java.lang.ClassCastException: bbj cannot be cast to bes
at net.eq2online.macros.core.MacroModCore.transformKeyBindings(MacroModCore.java:759)
at net.eq2online.macros.core.MacroModCore.onRender(MacroModCore.java:735)
at net.eq2online.macros.LiteModMacros.onRender(LiteModMacros.java:86)
at com.mumfrey.liteloader.client.ClientEvents.onRender(ClientEvents.java:517)
at com.mumfrey.liteloader.client.CallbackProxyClient.onRender(CallbackProxyClient.java:153)
at bao.ak(SourceFile:800)
at bao.f(SourceFile:728)
at net.minecraft.client.main.Main.main(SourceFile:148)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
Is anyone else having problems with the 1.7.2 version suddenly? I assume this is a coincidence and they're in no way connected but out of nowhere this morning my client crashes after the Mojang logo screen when loading my profile with 1.7.2 liteloader and macro mod. I haven't changed anything in the files, it was working fine last night before I left.
Have you tried wrapping the string in quotes?, it's optional sometimes, but when special characters break your script (such as if you need to put parentheses inside your text), quoting it should fix it
for example, Echo("this parentheses -> ) <- is ignored by the script engine")
EFFECTNAME and EFFECTTIME only exist for a specific effect (what would they even be if you had many), which means you can't simply paste those on a label, you can only use them in a script inside a ForEach(effects);stuffHere;Next loop
Thanks! But it's impossible to use %EFFECTNAME% in a label?
@ Edit: And I did not understand the explanation of the command UNSAFE; it speeds up or something?
And I did not understand the explanation of the command UNSAFE; it speeds up or something?
If you don't understand what UNSAFE does, don't use it. It's called UNSAFE for a reason
--------
In other news have a new build, it's 20% cooler than the last build and infinitely less likely to derp the hell out thanks to the fact that everything isn't run synchronously now (derp). I also fixed the missing obfuscations so the crashes in the controls gui should be fixed too.
Have you tried wrapping the string in quotes?, it's optional sometimes, but when special characters break your script (such as if you need to put parentheses inside your text), quoting it should fix it
for example, Echo("this parentheses -> ) <- is ignored by the script engine")
Yes, I have tried using quotes in my strings. Nothing changes when doing so since it's being treated the same. I'm 99.9% sure that it's a bug because I have been using macros ever since Minecraft 1.2 and the only issues I have tend to be slight bugs once in a while. They always get fixed though, but I think this one was overlooked or no one has been using the Craft syntax for quite some time now (even I'm guilty of this heh heh).
Thanks! But it's impossible to use %EFFECTNAME% in a label?
@ Edit: And I did not understand the explanation of the command UNSAFE; it speeds up or something?
Ask yourself this..., if you currently have the following effects
[Slowness II 0:12]
[Blindness I 0:02]
[Poison I 0:07]
...what exactly is EFFECTNAME?
See.., it doesn't make sense unless you somehow enter the context of one of your effects
that is what an iterator does, it runs a piece of code once for each effect, every time it does that it has a specific effect in mind, and suddenly the effect-related environment variables have meaning
@Mumfrey, will there be support for making auto-synchronous macros or do we just need to EXEC them to do that?
Also, I made a fork-bomb for macros. I feel evil.
I have no intention of making synchronous/asynchronous a user-facing property. I only intend to use it for making events whose handlers can alter an outcome, therefore synchronous macros will only ever be used for certain events and won't be available elsewhere.
I have no intention of making synchronous/asynchronous a user-facing property. I only intend to use it for making events whose handlers can alter an outcome, therefore synchronous macros will only ever be used for certain events and won't be available elsewhere.
Well, everything is async in macros. The only macros which don't run asychronously are chatfilter macros and (now) onSendChatMessage, since their outcome alters the flow of messages and thus execution can't continue until the script has been fully executed. All other macros are executed by being injected into the execution queue and then given an appropriate timeslice based on their structure and current pre-emption settings, this ensures that whilst it's possible to use macros to seriously slow down the game (if you are crazy enough), it shouldn't ever be possible to actually crash it via unyielding macros.
exec $$<script.txt> is invalid code, what you mean is Exec(script.txt)
when you use $$<script.txt>, the mod reads over the script first, finds that pattern "called a file include", deletes it and blindly pastes the entire contents of the file in it's place
once all $$<>'s and $$?'s have been replaced, only then is the script actually run, and it all acts as if it had been written into one file, one binding
when you use Exec(script.txt), that is only triggered once the script reaches that point (as opposed to before the script even starts running.., it creates a new process that runs independently of the current one, the new one running the code in the file (script tags not necessary), and both processes run separately, not waiting for eachother
Exec'd processes also have their own separate local variables
Usually you don't want to use Exec.., Exec is mainly only if you need asynchronous processes (two things running at the same time doing different things)
As an actual example, imagine file one is
$<file2.txt>
For(#i,1,10)
Log(%#i%)
Loop
And file 2 is
For(#i,11,20)
Log(%#i%)
Loop
If you run file one, the output will be:
11,12,13...19,20,1,2,3,...,8,9,10
If the file include was an Exec(file2.txt), you might see something like this instead:
11,1,2,12,13,3,14,4,15,5,6,16
'Cause tomorrow spring is here
...you don't want to know
'Cause tomorrow spring is here
I have noticed since the 1.6 release of Macro Keybind has finally breached my sanity. After mining a lot on a prison server, I wanted to auto-craft ores and redstone into blocks. Fair enough, I head to a crafting table, set up a macro, and it doesn't work. After extensive SSP testing, I have found the problem. It appears that ever since block IDs have been changed to full names, anything with underscores is somehow bugging out. I can craft basic items perfectly fine, such as redstone, pistons, and doors. However, I can not craft items such as redstone_block, diamond_block, flint_and_steel, etc.
Thank you, Mumfrey, for updating Macro Keybind to a beta 1.7.10 version, as well as your fantastic work on LiteLoader.
Have you tried wrapping the string in quotes?, it's optional sometimes, but when special characters break your script (such as if you need to put parentheses inside your text), quoting it should fix it
for example, Echo("this parentheses -> ) <- is ignored by the script engine")
EFFECTNAME and EFFECTTIME only exist for a specific effect (what would they even be if you had many), which means you can't simply paste those on a label, you can only use them in a script inside a ForEach(effects);stuffHere;Next loop
And Unsafe was explained to you already!, for example HERE(mumfrey) or the very next post HERE(mart3323)
'Cause tomorrow spring is here
They're not commands (and i'm not being pedantic, it's very important to be able to tell the difference), they're environment variables
And all the percent signs do is convert the value to a literal string (if the script isn't expecting a variable)
For example
IF(HEALTH < 20) becomes IF(20 < 20), which is what you want
IF(%HEALTH% < 20) becomes IF("20" < 20), which is not correct (comparing a string to a number is nonsense and random(ish))
however, a command like Echo expects a literal string, so in that case you need percent signs to make a string, so..
Echo(My health is HEALTH) >> "My health is HEALTH"
Echo(My health is %HEALTH%) >> My health is "20" >> "My health is 20"
so in this case you do need percent signs
In any case, commands are IF() and Echo(), %HEALTH% on it's own is meaningless, it's not an action, it's a value
Now, as for the list of them.., http://mkb.bplaced.net/#/wiki/variables
You can also run ForEach(env);Log(%VARNAME%);Next to get a list of them all, or use your own script to maybe filter some out and show values if you want, the point is you can also iterate over the names of every global variable using ForEach(env)
'Cause tomorrow spring is here
You did nothing wrong (unless both did wrong :p). I have LiteLoader 1.7.10_02 installed, not hooked to anything.
Only mod installed is macros:
Logfile:
Is anyone else having problems with the 1.7.2 version suddenly? I assume this is a coincidence and they're in no way connected but out of nowhere this morning my client crashes after the Mojang logo screen when loading my profile with 1.7.2 liteloader and macro mod. I haven't changed anything in the files, it was working fine last night before I left.
Yeah I know, the synchronous code isn't working properly and everything is running synchronous.
Thanks! But it's impossible to use %EFFECTNAME% in a label?
@ Edit: And I did not understand the explanation of the command UNSAFE; it speeds up or something?
If you don't understand what UNSAFE does, don't use it. It's called UNSAFE for a reason
--------
In other news have a new build, it's 20% cooler than the last build and infinitely less likely to derp the hell out thanks to the fact that everything isn't run synchronously now (derp). I also fixed the missing obfuscations so the crashes in the controls gui should be fixed too.
Yes, I have tried using quotes in my strings. Nothing changes when doing so since it's being treated the same. I'm 99.9% sure that it's a bug because I have been using macros ever since Minecraft 1.2 and the only issues I have tend to be slight bugs once in a while. They always get fixed though, but I think this one was overlooked or no one has been using the Craft syntax for quite some time now (even I'm guilty of this heh heh).
Try re-downloading now. I think I uploaded the wrong file :/
Ask yourself this..., if you currently have the following effects
[Slowness II 0:12]
[Blindness I 0:02]
[Poison I 0:07]
...what exactly is EFFECTNAME?
See.., it doesn't make sense unless you somehow enter the context of one of your effects
that is what an iterator does, it runs a piece of code once for each effect, every time it does that it has a specific effect in mind, and suddenly the effect-related environment variables have meaning
'Cause tomorrow spring is here
Also, I made a fork-bomb for macros. I feel evil.
I have no intention of making synchronous/asynchronous a user-facing property. I only intend to use it for making events whose handlers can alter an outcome, therefore synchronous macros will only ever be used for certain events and won't be available elsewhere.
Okay, EXEC is as good as async.
Well, everything is async in macros. The only macros which don't run asychronously are chatfilter macros and (now) onSendChatMessage, since their outcome alters the flow of messages and thus execution can't continue until the script has been fully executed. All other macros are executed by being injected into the execution queue and then given an appropriate timeslice based on their structure and current pre-emption settings, this ensures that whilst it's possible to use macros to seriously slow down the game (if you are crazy enough), it shouldn't ever be possible to actually crash it via unyielding macros.