Well he just told you it is no longer an integer it is a string. So you need to use &id because the '&' symbol represents a string. The '#' represents an integer and id's are no longer integers.
Yea, just realized that one.
One other question, I can't seem to find names for specific potions. Drawing the name from the getslotitem simply says 'potion'. Is there no way to differentiate between potions anymore?
In 1.7 and on there is no longer block ids, they are now there name, for example minecraft:stone. This means that the id is now the name and it is no longer an integer it is a string. I hope this helps.
It should still be assigning the name to it though right? If I add a log(%#id%) afterward, I simply get a '1' if an item is there. What do I put in the place of the #id to capture the item name to use farther down the loop?
INDEXOF(&test[],#pos,"%#chat[2]%");
IF(#pos > -1)
// player is in the array
ELSE
// player is not in the array
ENDIF;
I have no idea.
No, it still needs valid tokens for each expression, you still need to expand #j to its value prior to parsing so
IF(&test[%#j%] = &chat[2]);
is the correct syntax.
This worked beautifully. My next question is, since I am preforming all this using an ONCHAT macro, is it possible to make the macro wait until it finishes to run again? My problem is that it goes for about 2 minutes. Someone else can message in that time, and steal the variable chat[2] and end up catching the second half of the macro instead of the original player who messaged.
INDEXOF(&test[],#pos,"%#chat[2]%");
IF(#pos > -1)
// player is in the array
ELSE
// player is not in the array
ENDIF;
I have no idea.
No, it still needs valid tokens for each expression, you still need to expand #j to its value prior to parsing so
IF(&test[%#j%] = &chat[2]);
is the correct syntax.
Thank you so much Mumfrey for the quick response and help. This mod has allowed me to play so little minecraft while playing so much minecraft! Keep up the amazing work. I will test all this when I get home from work.
The problem is, it won't actually stop the idiots posting, because they never read the thread beforehand and I get the impression many don't even read the replies, so there's always the barrage of stupid and any measure of context or sense is just lost on them. The thing about having an angry image macro to post is that at least it provides some catharsis for me.
Expansion inside conditionals works differently to expansion elsewhere, so what looks right when you LOG it is not providing the result you want because it's expanding to the wrong thing:
Basically the condition engine works with numbers only, so for string comparisons it actually assigns each new string a unique ID number and compares those, so if you have two strings "foo" and "bar" imagine that the condition engine assigns random numbers to the strings and works it out like this:
IF("foo" = "bar");
becomes
IF(2347224 = 3249872);
so it's true or false, which is why
IF("foo" > "bar");
could produce a random result (it probably won't because the "random number" is from a fixed pool).
The % sign expansion operator recursively expands a variable to a string representation of itself and in most places in the script engine this means it converts a variable to its literal value. However conditionals act on variable names as tokens in order to preserve the symantics of the expression for as long as possible, this means that in expression unless you really mean it you should not use the expansion operator. The reason is, a string could contain (for example) the text "6 > 7" but expanding the variable in-place would actually change the meaning of the expression, thus a variable &foo which contains that text would yield:
IF(&foo = "6 > 7"); // pre-processing
IF(&foo = 2348674); // literal token replacement
IF(2348674 = 2348674); // value of variable inserted, replaced with string literal token
The behaviour for the expansion operator when used inside a conditional thus forcibly quotes the contents of any string variables, so the following happens:
Now you know this, you can see that using %'s in your string comparison is actually messing up the expression, because you're quoting a replacement which is causing it to be treated as a string, doubling up on the quotes when the variable is expanded:
You have quotation marks around %&chat[2]% but not around %&test[%#j%]%
Be consistent, have them around both or neither (i'm not sure if that causes errors but it might be it)
Besides that, i was confused as to the purpose of the #b = 1
I left out a lot of the code because it is quite lengthy. It essentially sets that variable equal to 1 to confirm that said person is already on the list and should be denied access. It is used later on in an if loop to run the actual commands necessary for access. It is a tool I used to make the code more modular while I tested what was going wrong. I still don't really understand why I would get positive results from the above code over and over. It claims that each time the two sides are equal and outputs #b = 1. I am overall a bit confused about the process of comparing strings.
I am working on a macro for a bot in which people message me to get access to a group temporarily.
My problem I am running into is comparing strings.
My macro builds an array of players that message me that I empty daily manually. The script runs through this array 1 item at a time and compares the names to the person that just messaged me. If it matches, it denies them access. For some reason, it is declaring that it always matches and I think the issue is in my comparison of two strings.
Is there a way to install this 'standalone version' alongside forge and liteloader mods? I currently launch using my Liteloader which is tied to the Forge jar.
0
log(%XPOS%); returned the xcoord before...now it only returns "XPOS"
Is there a new function for grabbing your current coordinates?
0
Is it possible to acquire said data with macromod?
0
Yea, just realized that one.
One other question, I can't seem to find names for specific potions. Drawing the name from the getslotitem simply says 'potion'. Is there no way to differentiate between potions anymore?
0
It should still be assigning the name to it though right? If I add a log(%#id%) afterward, I simply get a '1' if an item is there. What do I put in the place of the #id to capture the item name to use farther down the loop?
0
getslotitem(slot,#id,#stack)
Is not attaching a value to the #id variable.
0
This worked beautifully. My next question is, since I am preforming all this using an ONCHAT macro, is it possible to make the macro wait until it finishes to run again? My problem is that it goes for about 2 minutes. Someone else can message in that time, and steal the variable chat[2] and end up catching the second half of the macro instead of the original player who messaged.
0
Thank you so much Mumfrey for the quick response and help. This mod has allowed me to play so little minecraft while playing so much minecraft! Keep up the amazing work. I will test all this when I get home from work.
0
Could you show me the format of how I would use that INDEXOF?
Also, I still don't quite understand why it is replying them as being equal. I thought it would default to it being false.
Would
provide the result I am looking for?
0
I left out a lot of the code because it is quite lengthy. It essentially sets that variable equal to 1 to confirm that said person is already on the list and should be denied access. It is used later on in an if loop to run the actual commands necessary for access. It is a tool I used to make the code more modular while I tested what was going wrong. I still don't really understand why I would get positive results from the above code over and over. It claims that each time the two sides are equal and outputs #b = 1. I am overall a bit confused about the process of comparing strings.
I will test the quotes when I get home later.
Thanks!
0
My problem I am running into is comparing strings.
My macro builds an array of players that message me that I empty daily manually. The script runs through this array 1 item at a time and compares the names to the person that just messaged me. If it matches, it denies them access. For some reason, it is declaring that it always matches and I think the issue is in my comparison of two strings.
Here is the problematic section:
'&test' is the array with the saved names from previous requests
'&chat' is the player who just messaged me.
The 'log' commands I have just before output properly showing for example:
test = player1
chat = player2
Yet, it will output #b = 1 saying that player 1 = player 2.
I hope I am simply messing up comparing strings.
Thanks!
0
0
Promoted.
0
Promoted
Promoted
Promoted
0
0
http://www.minecraftforum.net/topic/1461783-fixing-lag-and-freezing-when-joining-a-mp-server/