Can someone help me out? I’m looking to auto solve math problems that occur in chat, but I can’t get the numbers to add up in string form and when I try to convert it to a number the output is always 1
The Meaning of Life, the Universe, and Everything.
Location:
...
Join Date:
6/22/2011
Posts:
46
Minecraft:
Noobthebuilder
Member Details
I have a few questions:
How do I set a variable and check it later?
Like for Javascript it is var name = <whatyoutypehere>
and then you can call it by if (<whatyoutypedhere> == X) { action}
How would this look like in this mod? And what kind of programming language is this? I have a little python and javascript knowledge, but this one seems to be a bit confusing. Thanks for helping me out!
Can someone help me out? I’m looking to auto solve math problems that occur in chat, but I can’t get the numbers to add up in string form and when I try to convert it to a number the output is always 1
This is a late response, but oh well. This does not work because Macro Mod cannot parse equations in string format into integer format in the way you are trying to. You would have to either (A) use a module that provides an evaluation function, of which there is one available in the "utilities" module available here: https://spthiel.github.io/Modules/. If using this module, your code would look like this:
ifmatches(%chatclean%,"Math problem: ([\s\S]+)",&problem,1);
eval(&answer,"%&problem%");
log("Answer is %&answer%");
endif;
Although that would not provide a result in integer format. If you needed an integer from that evaluation, you would have to further break down the &answer variable using match or split (as it may contain a decimal value, which Macro Mod cannot support), or if the string is a valid integer (no decimal values) you could explode it into integer format using the pascal := operator, like so:
ifmatches(%chatclean%,"Math problem: ([\s\S]+)",&problem,1);
eval(&answer,"%&problem%");
log("Answer is %&answer%");
ifmatches(%&answer%,"^(\d+)$");
#answer_int := %&answer%;
log("Integer format of answer is %#answer_int%.");
endif;
endif;
If you are not capable of using a module to handle this arithmetic, the alternative would be for you to come up with a way of breaking the equation down into it's parts (BEDMAS/PEMDAS applies), extracting the operators and numbers, then depending on what type of operation is being done, assign a result per-step of the algebra using the integers formed from either regular expressions or pascal (:=) string explosion. This would be pretty complicated, and I am not going to show an example for that because that's going to take me the rest of the evening to write out, lol.
Like for Javascript it is var name = <whatyoutypehere>
and then you can call it by if (<whatyoutypedhere> == X) { action}
How would this look like in this mod? And what kind of programming language is this? I have a little python and javascript knowledge, but this one seems to be a bit confusing. Thanks for helping me out!
To set variables, you can use standard variable declaration, prepending the '&' sign for strings, the '#' sign for integers, and no prefix for booleans. To make variables global (available after the script context which created or last edited the variable dies, as well as available across different script contexts), you can prepend the '@' sign before whatever other prefix you might use to declare or define the variable. You can apply these same concepts to the "set" function, as well. To check a variable later, depending on the context you are "checking" it in, you simply wrap it in percentage signs to explode it into a string (i.e. to have it spit out in a log statement), or if you are evaluating the content of a variable in a condition, you can forgo the percentage signs. For example:
&local_string = "foo";
#local_integer = 69;
local_boolean = true;
@&global_string = "bar";
@#global_integer = 420;
@global_boolean = true;
set(&local_string,"foo");
set(#local_integer,69);
set(local_boolean,true);
set(@&global_string,"bar");
set(@#global_integer,420);
set(@global_boolean,true);
if(&local_string == "true");
log("Local string is true (%&local_string%)!");
else;
log("Local string is not true (%@&global_string%)!");
endif;
if(@&global_string == "true");
log("Global string is true (%@&global_string%)!");
else;
log("Global string is not true (%@&global_string%)!");
endif;
if(#local_integer = 69);
log("Local integer is funny sex number (%#local_integer%)!");
else;
log("Local integer is not funny sex number (%#local_integer%)!");
endif;
You get the idea... These are all examples of valid variable declaration / definition. As for what language MacroMod is, that is a hard one to answer. Consider it a language of it's own
@droby the reason the [ ] do something is because ifmatches uses regex, instead I suggest you use ifcontains for simple things where you don't need regex
Hi, I have a error getting nullpointerexeption on my script, any help?
[22:50:24] [main/INFO] [LiteLoader]: java.lang.NullPointerException
at net.eq2online.macros.core.executive.MacroAction.executeAction(MacroAction.java:258)
at net.eq2online.macros.core.executive.MacroAction.execute(MacroAction.java:169)
at net.eq2online.macros.core.executive.MacroActionProcessor.execute(MacroActionProcessor.java:226)
at net.eq2online.macros.core.Macro.play(Macro.java:464)
at net.eq2online.macros.core.Macros.onTick(Macros.java:1064)
at net.eq2online.macros.core.MacroModCore.onTickInGame(MacroModCore.java:265)
at net.eq2online.macros.core.MacroModCore.onTick(MacroModCore.java:245)
at net.eq2online.macros.LiteModMacros.onTick(LiteModMacros.java:120)
at com.mumfrey.liteloader.core.event.HandlerList$Tickable9.onTick(HandlerList$Tickable9.java:100)
at com.mumfrey.liteloader.client.LiteLoaderEventBrokerClient.onTick(LiteLoaderEventBrokerClient.java:433)
at net.minecraft.client.Minecraft.handler$onTick$zbh000(Minecraft.java:3924)
at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1117)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:397)
at net.minecraft.client.main.Main.main(SourceFile:123)
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:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
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 org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:196)
at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:231)
at org.multimc.EntryPoint.listen(EntryPoint.java:143)
at org.multimc.EntryPoint.main(EntryPoint.java:34)
Hello, I have spent a good time creating this script to grow crops for hours, I already solved all the problems that arose for not knowing how to program but now I have a bump, I just finished but I don't know how to start the attack action pressed, I have read too much from here and I still have no idea, keydown () does not work to attack and key () only presses the key once, here I leave the script in case someone is curious and can help me integrate the action of attack and leave it pressed as long as the script works
Oh ok great thanks for pointing this out! Why the specific version of forge?
Forge NEVER stops updating...
LiteLoader did.
2705 was probably the highest recommended when I downloaded Mr. Muphrey's offerings.
I don't think I've ever used any Forge version beyond the highest recommended, I see no reason to!
Links to pdf format, downloadable, command lists for (these often clarify/expand descriptions, and where possible link to the author's posting):
MoreCommands: http://www.mediafire.com/view/qjc9c6klcnp660e/CmdLstMoreCommands.pdf
WorldEdit: http://www.mediafire.com/view/bi7r00xd9rgxrrt/WE_Commands.pdf
Can someone help me out? I’m looking to auto solve math problems that occur in chat, but I can’t get the numbers to add up in string form and when I try to convert it to a number the output is always 1
here is my current script in the chatfilter
ifmatches(%chatclean%, “Math problem: ([\s\S]+),&problem,1);
#math = (%&problem%);
log(%#math%);
endif
What about Fabric? Id love mc 1.13+ (fabric) (and also please add it to Curseforge)
I have a few questions:
How do I set a variable and check it later?
Like for Javascript it is var name = <whatyoutypehere>
and then you can call it by if (<whatyoutypedhere> == X) { action}
How would this look like in this mod? And what kind of programming language is this? I have a little python and javascript knowledge, but this one seems to be a bit confusing. Thanks for helping me out!
[SSSS]
For words, you can use:
&word = test;
if (%&word% == test)
log ("true");
else
log ("false");
endif;
for numbers use:
#number = 100;
>> Link to Curseforge <<
This is a late response, but oh well. This does not work because Macro Mod cannot parse equations in string format into integer format in the way you are trying to. You would have to either (A) use a module that provides an evaluation function, of which there is one available in the "utilities" module available here: https://spthiel.github.io/Modules/. If using this module, your code would look like this:
Although that would not provide a result in integer format. If you needed an integer from that evaluation, you would have to further break down the &answer variable using match or split (as it may contain a decimal value, which Macro Mod cannot support), or if the string is a valid integer (no decimal values) you could explode it into integer format using the pascal := operator, like so:
If you are not capable of using a module to handle this arithmetic, the alternative would be for you to come up with a way of breaking the equation down into it's parts (BEDMAS/PEMDAS applies), extracting the operators and numbers, then depending on what type of operation is being done, assign a result per-step of the algebra using the integers formed from either regular expressions or pascal (:=) string explosion. This would be pretty complicated, and I am not going to show an example for that because that's going to take me the rest of the evening to write out, lol.
To set variables, you can use standard variable declaration, prepending the '&' sign for strings, the '#' sign for integers, and no prefix for booleans. To make variables global (available after the script context which created or last edited the variable dies, as well as available across different script contexts), you can prepend the '@' sign before whatever other prefix you might use to declare or define the variable. You can apply these same concepts to the "set" function, as well. To check a variable later, depending on the context you are "checking" it in, you simply wrap it in percentage signs to explode it into a string (i.e. to have it spit out in a log statement), or if you are evaluating the content of a variable in a condition, you can forgo the percentage signs. For example:
You get the idea... These are all examples of valid variable declaration / definition. As for what language MacroMod is, that is a hard one to answer. Consider it a language of it's own
Hey, I'm trying to create a script that triggers when someone gets punished on our server.
The message looks like this:
The main problem is, that "[" and "]" are blue in the script, so they're doing something but I'm not sure what.
Also it don't work with "%CHATCLEAN%" either.
$${
IFMATCHES(%CHAT%,"&cwurde von [UC]Droby zu");
LOG("Ban-Log!");
LOG("Ban-Log!");
ENDIF;
}$$
Could you help me out?
Did you put that in onChat?
To avoid these characters test it with
Test it without color-formatting
>> Link to Curseforge <<
Yes, yours worked, thank you ♥
Any way to get a target? Like for example you're looking at a creeper, then it outputs creeper?
For example:
If(%targetifthisexists% = creeper);
dothis
else if(%targetifthisexists% = mocreatures:Ogre); #this is a modded mob from a mod
dothis
else(%targetifthisexists% = null);
donothing
endif
And where can I find a documentation on everything?
[SSSS]
As for documentation check https://beta.mkb.gorlem.ml/docs/actions
As for the actual question: the HIT variables will be of help to you
@droby the reason the [ ] do something is because ifmatches uses regex, instead I suggest you use ifcontains for simple things where you don't need regex
What would you put for parameters for running a macro that keydown(forward);wait(1);keyup(forward); this is a placeholder
Hi, I have a error getting nullpointerexeption on my script, any help?
Hello, I have spent a good time creating this script to grow crops for hours, I already solved all the problems that arose for not knowing how to program but now I have a bump, I just finished but I don't know how to start the attack action pressed, I have read too much from here and I still have no idea, keydown () does not work to attack and key () only presses the key once, here I leave the script in case someone is curious and can help me integrate the action of attack and leave it pressed as long as the script works
do;
look(0,0);
look(88,0);
keydown(forward);
wait(250ms);
keydown(right);
wait(24000ms);
keyup(right);
look(0,0);
look(92,0);
keydown(left);
wait(24000ms);
keyup(left);
keydown(forward);
look(0,0);
look(88,0);
keydown(right);
wait(24000ms);
keyup(right);
keydown(forward);
look(0,0);
look(92,0);
keydown(left);
wait(24000ms);
keyup(left);
keyup(forward);
keydown(back);
wait(250ms);
keyup(back);
loop;
@Rodr you will have to create a seperate script in which you put a loop to attack
cleared up
mod download doesnt work
The links on the first page are still working
Maybe test it with another browser
>> Link to Curseforge <<