if GetSlot() and SlotClick() work then yes.., but there's no simple one-liner for it
IIRC, trades only reset when you don't have the villager GUI open, which makes it an external event..
[snip]
Hmm, I'm not sure its even worth the effort. I messed around with it but I didn't see a way to select which trade (clicking the arrows to change the trades).
I'm still struggling to learn the syntax and variable system, is there a good tutorial somewhere?
I'm trying to get the first empty slot in the player inventory while viewing a double chest, but no matter what I do with GetSlot it always seems to output "0". The double chest is completely full of chicken and player inventory has a few items and tools.
Hmm, I'm not sure its even worth the effort. I messed around with it but I didn't see a way to select which trade (clicking the arrows to change the trades).
I'm still struggling to learn the syntax and variable system, is there a good tutorial somewhere?
I'm trying to get the first empty slot in the player inventory while viewing a double chest, but no matter what I do with GetSlot it always seems to output "0". The double chest is completely full of chicken and player inventory has a few items and tools.
Here's my snippet:
getslot(0,#AirInv,54)
log(%#AirInv%)
Maybe somebody can help
1) You can not use mixed case in variable names.., they just won't work
2) 0 is not a valid item ID anymore.., what you want is "air"
My only thing in my inventory is a stack of chicken in slot 18.
Sorry if I'm cluttering the thread a bit, hopefully I'll start to figure this out soon..
Yes, that's correct, my bad
I mistook GetSlot for GetSlotItem, noticed my mistake, then forgot about it and made the mistake again =S
I think that's a bug, yes, one would expect those commands to be symmetric
A workaround right now is to For(#i,%#startslot%,%#endslot%) and GetSlotItem() each slot, comparing the return value to "air"
Yes, that's correct, my bad
I mistook GetSlot for GetSlotItem, noticed my mistake, then forgot about it and made the mistake again =S
I think that's a bug, yes, one would expect those commands to be symmetric
A workaround right now is to For(#i,%#startslot%,%#endslot%) and GetSlotItem() each slot, comparing the return value to "air"
I'm working on a quick empty script for chests, the existing ones I've found have for loops and they are quite a bit slower...
Here's the solution I've come up with so far:
KEY("use")
wait(150ms)
GetSlotItem(54,&fullitem)
IF( %&fullitem% != "air")
log("The first inventory slot must be empty!")
log("Instead, it is %&fullitem%)
GUI();
stop();
ENDIF;
do;
GetSlot("chicken",#chslot)
GetSlotItem(54,&fullitem)
IF( (%#chslot% > 53) || (%#chslot% = -1))
BREAK;
ENDIF
SlotClick(%#chslot%,1,true);
IF( %&fullitem% != "air")
break;
ENDIF;
while(1);
GUI();
I'm working on a quick empty script for chests, the existing ones I've found have for loops and they are quite a bit slower...
Here's the solution I've come up with so far:
KEY("use")
wait(150ms)
GetSlotItem(54,&fullitem)
IF( %&fullitem% != "air")
log("The first inventory slot must be empty!")
log("Instead, it is %&fullitem%)
GUI();
stop();
ENDIF;
do;
GetSlot("chicken",#chslot)
GetSlotItem(54,&fullitem)
IF( (%#chslot% > 53) || (%#chslot% = -1))
BREAK;
ENDIF
SlotClick(%#chslot%,1,true);
IF( %&fullitem% != "air")
break;
ENDIF;
while(1);
GUI();
If speed is actually a concern...
Every block (IF;ENDIF; DO;LOOP.., any kind of paired command) incurs a delay when it is entered or exited
specifically, it pauses execution until the next tick (20'th of a second)
You can, however, prevent this
There is a block, Unsafe(n);;ENDUNSAFE
What it does.., is instead of pausing on EVERY stack pop like it normally does, it will only do so on every n'th
this should more or less result in n times faster execution
with no arguments, it will handle infinite stack pops.., which means it either completes its' task with the maximum possible speed.., or if for some reason it gets stuck in a loop then it will drag the game down with it (because everything else is waiting for it to finish processing)
---
So, basically, to tl;dr all this.., if your script is slow because there's lots of conditons and other blocks in.., you can do Unsafe(10);ENDUNSAFE to make it run 10 times as fast
make sure the number is only as large as you need, and never omit the number, because very bad things happen if you get greedy with your speed
Hmm, I'll mess around with that in a bit. For now my solution is working fairly well compared to a brute force for loop...
A more sure fire way is to check diagnoly, from the first slot to the last. Its faster than check all of them with more accuracy than your method. However, the correct method is to check every slot with an unsafe over it.
I know that the version im using is a beta (1.8) and liteloader is in beta as well for that version of mc. But can any one confirm that CraftAndWait is broken on this version?
I know that the version im using is a beta (1.8) and liteloader is in beta as well for that version of mc. But can any one confirm that CraftAndWait is broken on this version?
A more sure fire way is to check diagnoly, from the first slot to the last. Its faster than check all of them with more accuracy than your method. However, the correct method is to check every slot with an unsafe over it.
I'm curious why the "correct" method would be to check every slot rather than GetSlot for air and GetSlot for the target? Actually typing this I realize its probably because behind the scenes "GetSlot" does a loop so its redundant to do it repeatedly?
I'm curious why the "correct" method would be to check every slot rather than GetSlot for air and GetSlot for the target? Actually typing this I realize its probably because behind the scenes "GetSlot" does a loop so its redundant to do it repeatedly?
the correct way to "do X for every Y" is by definition a loop =P
If you want to check if they're all air (hoping i didn't mess up the syntax writing this by heart but i'm sure you get what i mean)..,
Set(all_air) // Assume all air until proven otherwise
For(#i,start,end); // Check every slot for a contradiction, finding just one is enough
GetSlotItem(%#i%,&item);
IF(ITEM!= "air");
UnSet(all_air)
break; // skip the rest of the looping process
ENDIF;
Next
Log(all_air)
// all_air is now correct
---
Kind of a repeat.., but does anyone have a lexer/parser for this language? Would love for my IDE to support it but i can't quite figure out how to make it myself
// REMEMBER YOUR CURRENT POSITION
// CALCULATE THE POSITION ONE BLOCK LEFT
// PRESS DOWN LEFT
// DO; NOTHING; UNTIL(YOU ARE AT THE NEW POSITION)
// RELEASE LEFT
#xcor = XPOS
#ycor = YPOS
IF(YAW is in some range)
^Obviously this isn't going to work straight off the bat.., you first need to fill in the YAW ranges and also figure out what directions map to what coordinates
So, I am wondering if someone could make a macro like this:
If I see an auction I want to win, I can hit a button (I'd use X.) and the macro will look for an onChat that says "[floAuction] 1 second remaining", it will wait 18 ticks and then type /bid.
// REMEMBER YOUR CURRENT POSITION
// CALCULATE THE POSITION ONE BLOCK LEFT
// PRESS DOWN LEFT
// DO; NOTHING; UNTIL(YOU ARE AT THE NEW POSITION)
// RELEASE LEFT
#xcor = XPOS
#ycor = YPOS
IF(YAW is in some range)
^Obviously this isn't going to work straight off the bat.., you first need to fill in the YAW ranges and also figure out what directions map to what coordinates
Do you mean ZPOS?
That seems like a lot of code to walk one block left. Is there a way to take your current X coordinate, increase it by one, and push left until I reach that block? I don't mind if I look in the opposite direction that I walk, I just need to move one block left.
That seems like a lot of code to walk one block left. Is there a way to take your current X coordinate, increase it by one, and push left until I reach that block? I don't mind if I look in the opposite direction that I walk, I just need to move one block left.
What mart quoted is the correct way to do it, you can build your own model off of that. I'm very lenient to help you as i know you are using such macros for factions to bot money. Even though i have my own i do not use it often as it really ruins the game especially if someone who does not know what they are doing says gets caught (which its very easy to catch) then it starts getting patched everywhere.
This website has all the commands. http://mkb.bplaced.net/wiki/commands That same website also has all the variables under the variable tab. You should be able to piece together your script in no time. The pieces are easy, making it smooth and piecing it together is hard.
That seems like a lot of code to walk one block left. Is there a way to take your current X coordinate, increase it by one, and push left until I reach that block? I don't mind if I look in the opposite direction that I walk, I just need to move one block left.
That is exactly what it does?
Also.., if you're looking at the opposite direction, how do you expect to get there by holding "left"?
i'm getting some conflicting messages here...
What mart quoted is the correct way to do it, you can build your own model off of that. I'm very lenient to help you as i know you are using such macros for factions to bot money. Even though i have my own i do not use it often as it really ruins the game especially if someone who does not know what they are doing says gets caught (which its very easy to catch) then it starts getting patched everywhere.
This website has all the commands. http://mkb.bplaced.net/wiki/commands That same website also has all the variables under the variable tab. You should be able to piece together your script in no time. The pieces are easy, making it smooth and piecing it together is hard.
This makes me sad..., i really wish people didn't use this mod to cheat, but besides asking them not to (and not helping people who are obvious about it), there's not much that can be done unfortunately
Hmm, I'm not sure its even worth the effort. I messed around with it but I didn't see a way to select which trade (clicking the arrows to change the trades).
I'm still struggling to learn the syntax and variable system, is there a good tutorial somewhere?
I'm trying to get the first empty slot in the player inventory while viewing a double chest, but no matter what I do with GetSlot it always seems to output "0". The double chest is completely full of chicken and player inventory has a few items and tools.
Here's my snippet:
getslot(0,#AirInv,54)
log(%#AirInv%)
Maybe somebody can help
1) You can not use mixed case in variable names.., they just won't work
2) 0 is not a valid item ID anymore.., what you want is "air"
GetSlot("air",&item,54)
Log(%&item%)
'Cause tomorrow spring is here
Fantastic! I didn't realize that about mixed case variable names.
I imagined I would be looking at string names after noticing they were being used for other scripts.
EDIT:
I'm fairly certaing & indicates a string and # indicates a number, shouldn't "item" be #
This script outputs blank with & or -1 with #
I've got it successfully returning a chicken slot, but "air" doesn't seem to be working, perhaps I can't get air?
GUI(inventory)
GetSlot("chicken",#slotnum)
Log(%#slotnum%)
GETSLOTITEM(18,&slotinfo)
log(%&slotinfo%)
Output:
18
chicken
If I change "chicken" to "air" I get
-1
chicken
My only thing in my inventory is a stack of chicken in slot 18.
Sorry if I'm cluttering the thread a bit, hopefully I'll start to figure this out soon..
Yes, that's correct, my bad
I mistook GetSlot for GetSlotItem, noticed my mistake, then forgot about it and made the mistake again =S
I think that's a bug, yes, one would expect those commands to be symmetric
A workaround right now is to For(#i,%#startslot%,%#endslot%) and GetSlotItem() each slot, comparing the return value to "air"
'Cause tomorrow spring is here
I'm working on a quick empty script for chests, the existing ones I've found have for loops and they are quite a bit slower...
Here's the solution I've come up with so far:
KEY("use")
wait(150ms)
GetSlotItem(54,&fullitem)
IF( %&fullitem% != "air")
log("The first inventory slot must be empty!")
log("Instead, it is %&fullitem%)
GUI();
stop();
ENDIF;
do;
GetSlot("chicken",#chslot)
GetSlotItem(54,&fullitem)
IF( (%#chslot% > 53) || (%#chslot% = -1))
BREAK;
ENDIF
SlotClick(%#chslot%,1,true);
IF( %&fullitem% != "air")
break;
ENDIF;
while(1);
GUI();
If speed is actually a concern...
Every block (IF;ENDIF; DO;LOOP.., any kind of paired command) incurs a delay when it is entered or exited
specifically, it pauses execution until the next tick (20'th of a second)
You can, however, prevent this
There is a block, Unsafe(n);;ENDUNSAFE
What it does.., is instead of pausing on EVERY stack pop like it normally does, it will only do so on every n'th
this should more or less result in n times faster execution
with no arguments, it will handle infinite stack pops.., which means it either completes its' task with the maximum possible speed.., or if for some reason it gets stuck in a loop then it will drag the game down with it (because everything else is waiting for it to finish processing)
---
So, basically, to tl;dr all this.., if your script is slow because there's lots of conditons and other blocks in.., you can do Unsafe(10);ENDUNSAFE to make it run 10 times as fast
make sure the number is only as large as you need, and never omit the number, because very bad things happen if you get greedy with your speed
'Cause tomorrow spring is here
Hmm, I'll mess around with that in a bit. For now my solution is working fairly well compared to a brute force for loop...
A more sure fire way is to check diagnoly, from the first slot to the last. Its faster than check all of them with more accuracy than your method. However, the correct method is to check every slot with an unsafe over it.
I know that the version im using is a beta (1.8) and liteloader is in beta as well for that version of mc. But can any one confirm that CraftAndWait is broken on this version?
what version of mc and what version of macro mod and what version of liteloader?
Yep.., known bug in the beta..
'Cause tomorrow spring is here
Is there a list of known bugs for 1.8?
I'm curious why the "correct" method would be to check every slot rather than GetSlot for air and GetSlot for the target? Actually typing this I realize its probably because behind the scenes "GetSlot" does a loop so its redundant to do it repeatedly?
the correct way to "do X for every Y" is by definition a loop =P
If you want to check if they're all air (hoping i didn't mess up the syntax writing this by heart but i'm sure you get what i mean)..,
Set(all_air) // Assume all air until proven otherwise
For(#i,start,end); // Check every slot for a contradiction, finding just one is enough
Next
Log(all_air)
// all_air is now correct
---
Kind of a repeat.., but does anyone have a lexer/parser for this language? Would love for my IDE to support it but i can't quite figure out how to make it myself
'Cause tomorrow spring is here
What is the code to 'WALK ONE BLOCK LEFT'?
// REMEMBER YOUR CURRENT POSITION
// CALCULATE THE POSITION ONE BLOCK LEFT
// PRESS DOWN LEFT
// DO; NOTHING; UNTIL(YOU ARE AT THE NEW POSITION)
// RELEASE LEFT
#xcor = XPOS
#ycor = YPOS
IF(YAW is in some range)
Inc(#xcor)
ELSE IF(YAW is in the next range)
Inc(#ycor)
ELSE IF(YAW is in the next range)
ELSE IF(YAW is in the next range)
ELSE
ENDIF
KeyDown(left)
Do(60);Until(#xcor = XPOS && #ycor == YPOS)
KeyUp(left)
^Obviously this isn't going to work straight off the bat.., you first need to fill in the YAW ranges and also figure out what directions map to what coordinates
'Cause tomorrow spring is here
So, I am wondering if someone could make a macro like this:
If I see an auction I want to win, I can hit a button (I'd use X.) and the macro will look for an onChat that says "[floAuction] 1 second remaining", it will wait 18 ticks and then type /bid.
Do you mean ZPOS?
That seems like a lot of code to walk one block left. Is there a way to take your current X coordinate, increase it by one, and push left until I reach that block? I don't mind if I look in the opposite direction that I walk, I just need to move one block left.
What mart quoted is the correct way to do it, you can build your own model off of that. I'm very lenient to help you as i know you are using such macros for factions to bot money. Even though i have my own i do not use it often as it really ruins the game especially if someone who does not know what they are doing says gets caught (which its very easy to catch) then it starts getting patched everywhere.
This website has all the commands. http://mkb.bplaced.net/wiki/commands That same website also has all the variables under the variable tab. You should be able to piece together your script in no time. The pieces are easy, making it smooth and piecing it together is hard.
That is exactly what it does?
Also.., if you're looking at the opposite direction, how do you expect to get there by holding "left"?
i'm getting some conflicting messages here...
This makes me sad..., i really wish people didn't use this mod to cheat, but besides asking them not to (and not helping people who are obvious about it), there's not much that can be done unfortunately
'Cause tomorrow spring is here