1.7.2

Macro / Keybind mod 0.10.04 for 1.7.2

  • #4141
    Quote from Mumfrey
    • Removed relative syntax from GETID because it broke the ability to use negative X and Z coordinates!
    • Added GETIDREL which works the same as GETID but uses relative coordinates
    • Added new global variables HITX, HITY and HITZ, HITSIDE which correspond to the world coordinates of the hit block.

    Nice, that HITSIDE is going to be handy for determining whether or not you can plant crops etc. What kind of values does it output?

    Also the block oberver is going to become reality soon with the coordinates being easier to get. :)

    Quote from Mumfrey

    You shouldn't need to add the 1 tick waits everywhere, that's just unnecessarily slowing the script down. You can safely remove the waits between the multiple GETSLOTs and stuff.

    Basically, anything that's reading state need not wait, and anything that's modifying state need not wait, since those actions happen deterministically and the server won't "argue" with any valid 'move'. Where you do need waits is where reads occur after writes, so for example rather than 1 tick waits everywhere, put a 10 tick wait after crafting actions or between a set of slot clicks and getslots.

    Also a slightly neater and easier to read version of your initial IF would be:
    IF(HIT != "TILE");
    ACHIEVEMENTGET("Can't place torch here",50);
    STOP;
    ENDIF;
    IFMATCHES(%HITID%,"^(2[356]|5[48]|6[1249]|7[17]|84|9[2346]|107|11[678]|122|13[078]|14[35])$");
    ACHIEVEMENTGET("Can't place torch here",50);
    STOP;
    ENDIF;
    
    // Rest of the script here


    An option to avoid duplicate events if you're having trouble with lag spikes would be to run this as a daemon task. Basically EXEC your script from onJoinGame and wrap it in a structure like this:
    DO; // loop forever
    DO;UNTIL(KEY_R); // wait for key press
    
    // rest of script here
    LOOP; // go back and wait for key press


    The problem from the mod's point of view is that lag-induced key events are indistinguishable from real key events, so I guess what's needed is some kind of enforcable debounce for certain macros.

    Yeah, ifmatches is a bit better I guess. But is it possible to do elseifmatches? If not, you could add that.

    Call my crazy but I don't like to use stop() if possible, it is basically the equivalent of break in other programming languages and code is considered bad if it has to use breaks to work. I'm kind of studying to become a programmer so I just don't want to use that. Anyway, I did it without stops by nesting ifs and elses a bit more.

    A bit more questions about the waits; do you really need 10 tick waits, I have 2 ticks now and it seems fine to me? Also, do you need to wait after getslot or pick that would store a variable you want to check with an if? And for how long, the same 2 ticks I have which I have already done?

    I didn't try the daemon idea yet but wouldn't that cause lag in itself as it would be a constant macro running on every tick? I find the game starts to lag a bit if I have multiple macros running that have loops running on every tick. And I would need to have multiple macro keys checked for, too, and that would most likely lag.



    As an extra question/request I ask if it's possible to get entities' other data besides their ID? Like the color of a sheep or the profession of a villager etc.

    Another extra question, is there a shorter syntax to check if a flag is unset? I'm using IF(flag=0) but can you do IF(!flag) or something as checking for set flags is just IF(flag)?
    Last edited by Zelfana: 10/29/2012 9:08:56 PM
  • #4142
    A few of the answers

    Quote from Zelfana

    Nice, that HITSIDE is going to be handy for determining whether or not you can plant crops etc. What kind of values does it output?

    Also the block oberver is going to become reality soon with the coordinates being easier to get. :)


    Yeah, ifmatches is a bit better I guess. But is it possible to do elseifmatches? If not, you could add that.

    IFMATCHES()
    ELSE
    IFMATCHES() //close enough?
    ENDIF
    ENDIF


    Call my crazy but I don't like to use stop() if possible, it is basically the equivalent of break in other programming languages and code is considered bad if it has to use breaks to work. I'm kind of studying to become a programmer so I just don't want to use that. Anyway, I did it without stops by nesting ifs and elses a bit more.

    A bit more questions about the waits; do you really need 10 tick waits, I have 2 ticks now and it seems fine to me? Also, do you need to wait after getslot or pick that would store a variable you want to check with an if?

    No, as he said, waits are only needed when you perform a physical change (moving/crafting items) and then use a command like GetSlot or similar that needs to be aware of the recent change
    that's when you give the server some time to catch up, in case it momentarily reverts your action


    Basically, if it doesn't make sense without the mod (variables don't), it's updated instantly and in order

    And for how long, the same 2 ticks I have which I have already done?

    I didn't try the daemon idea yet but wouldn't that cause lag in itself as it would be a constant macro running on every tick? I find the game starts to lag a bit if I have multiple macros running that have loops running on every tick. And I would need to have multiple macro keys checked for, too, and that would most likely lag.
    I forgot what you were doing, but to signfificantly reduce lag on daemon tasks, simply add a wait before the end Loop, so it only checks, say, once every second?, two seconds?, ten?



    As an extra question/request I ask if it's possible to get entities' other data besides their ID? Like the color of a sheep or the profession of a villager etc.
    Check with %HITDATA%

    Another extra question, is there a shorter syntax to check if a flag is unset? I'm using IF(flag=0) but can you do IF(!flag) or something as checking for set flags is just IF(flag)?
    Yes, IF(!flag) does work
    Last edited by Mart3323: 10/30/2012 1:43:33 AM
    'Cause tomorrow spring is here
  • #4143
    Quote from Mart3323

    A few of the answers
    IFMATCHES()
    ELSE
    IFMATCHES() //close enough?
    ENDIF
    ENDIF


    Yeah I basically already did that but you have to keep nesting ELSE's after IFMATCHES to get multiple of these pseudo ELSEIFMATCHES.

    I forgot what you were doing, but to signfificantly reduce lag on daemon tasks, simply add a wait before the end Loop, so it only checks, say, once every second?, two seconds?, ten?

    The idea was to prevent multiple executions of macros that run for a while on keypresses and having waits in the loop would mean you would have to hold the key until the loop started again. I'll live with the issue for now, I have too many macros to check for in it.

    Check with %HITDATA%

    That is sadly 0 for every entity I have checked with it.

    Yes, IF(!flag) does work

    Thanks, I prefer efficiency so this will help some. I also kind of have OCD to make code as tight as possible. Funnily enough, though, I don't have use for this right now.


    Btw Mumfrey, I already went and figured out the HITSIDE by myself. Works like a charm. No more eating carrots or potatoes on accident when planting them.

    Another thing that I ran into is how the DURABILITY variable works with PICK. It works with items that use it to determine the actual item but items that have an actual durability won't be picked using that variable. Kind of a blame of how Minecraft handles durability but there should be a variable for the actual damage value.
    Last edited by Zelfana: 10/30/2012 3:35:47 AM
  • #4144
    Quote from Zelfana
    The idea was to prevent multiple executions of macros that run for a while on keypresses and having waits in the loop would mean you would have to hold the key until the loop started again. I'll live with the issue for now, I have too many macros to check for in it.

    I'm not sure what you're trying to do, but in case it helps, IF(~KEY_NAME) / IF(~CTRL) / etc. checks if a key was down when the macro started
    Quote from Zelfana

    Another thing that I ran into is how the DURABILITY variable works with PICK. It works with items that use it to determine the actual item but items that have an actual durability won't be picked using that variable. Kind of a blame of how Minecraft handles durability but there should be a variable for the actual damage value.

    No time to test it right now, but did you use the exact durability?, i mean, if you're off even by one it won't pick it, i presume
    Try using Log(%DURABILITY%) on a tool and then using PICK with that just after
    'Cause tomorrow spring is here
  • #4145
    Quote from Mart3323

    I'm not sure what you're trying to do, but in case it helps, IF(~KEY_NAME) / IF(~CTRL) / etc. checks if a key was down when the macro started

    That doesn't help because when the macro starts twice both of the instances clear that check. The keypress is fired twice by Minecraft but the two keypresses happen on the same tick and that makes it impossible to halt the second macro within the macro itself. Am I really the only one with this problem of lag spikes? Can't be, this is the same exact problem as blocks being placed twice when you only clicked once.

    No time to test it right now, but did you use the exact durability?, i mean, if you're off even by one it won't pick it, i presume
    Try using Log(%DURABILITY%) on a tool and then using PICK with that just after


    I'm pretty sure the durability is exactly the same on two of same tool with full durability. But it is exactly like I said, full tools have metadata of 0, not their logical durability left which is what DURABILITY will give you. And when tool is damaged that metadata is increased and when it is at a certain point that varies per item Minecraft will destroy it. This is why you can have "infinite" uses on items by setting the metadata to a large negative number.
    Last edited by Zelfana: 10/30/2012 4:54:08 AM
  • #4146
    Quote from MeepDarknessMeep

    So umm.. Mumfrey, dear? Did you think about parsing variables into variables? :o I have yet another reason to want it now :3

    If I do I want to make sure it has a different syntax to normal assignments. What about something like:
    %#var% <= HEALTH

    or the Pascal-style:
    %#var% := HEALTH

    Either of those sound okay?

    Quote from kiarules

    Mumfrey, how does one round a number? I suppose I could use a complicated regex and keep checking that, but is there a simpler way? I'm trying to fire /tp %PLAYER% %XPOS% %YPOS% %ZPOS% but it always fails with commands.generic.double.invalid printed in the chat screen

    You can only really round using a regex, but it's not a complicated one:
    MATCH(%#value%,"^([\d,]+")(\.\d+)?$",&value,1);SET(#value,%&value%);

    But the XPOS, YPOS and ZPOS are all integers anyway, in fact all numeric values used by the mod are integers. The macro you posted above would actually just try to teleport you to your own position, well it would provided it was inside an ECHO. If you just put that in as a chat command the server would probably choke on the raw string "/tp %PLAYER% %XPOS% %YPOS% %ZPOS%".

    Quote from Zelfana
    Nice, that HITSIDE is going to be handy for determining whether or not you can plant crops etc. What kind of values does it output?

    It outputs N,S,E,W,T,B or ? if no tile was hit.

    Quote from Zelfana
    Yeah, ifmatches is a bit better I guess. But is it possible to do elseifmatches? If not, you could add that.

    It's not currently possible by I may add it.

    Quote from Zelfana
    Call my crazy but I don't like to use stop() if possible, it is basically the equivalent of break in other programming languages and code is considered bad if it has to use breaks to work. I'm kind of studying to become a programmer so I just don't want to use that. Anyway, I did it without stops by nesting ifs and elses a bit more.

    This would be a sensible idea if this were a programming language, but because the scripts are interpreted you're causing the script parser to read the entire script even if you don't intend to run any of it. The script interpreter still reads every line inside a conditional block which is not executed because it's looking for the corresponding ENDIF and doesn't have a direct pointer to it like a compiled language does.

    Programming in reality, despite what they teach you, has to blend pragmatism and mindfulness of performance with idealism, which is why structures like break exist. It's the reason there's a world of difference between:
    someValue >> 1

    and
    someValue / 2

    even though they do the same thing.

    Breaks and returns aren't always evil either, at least not in the real world, since they can be used to drastically improve readability in certain circumstances. Nesting ifs is fine but in many circumstances it makes sense to test for the failure condition because otherwise exceptions and error condition handling can end up a long way from the test which caused them to be raised. Consider this function:
    public int exampleFunction(String param1, String param2)
    {
        int result;
    
        if (someSanityCheckingFunction(param1))
        {
            if (someOtherSanityCheckingFunction(param2)
            {
                //
                // A
                // whole
                // bunch
                // of
                // code
                // which
                // is
                // indented a tonne just
                // because of the sanity functions
            }
            else
            {
                throw new Exception("Exception for failure of sanity check function 2 ends up way down here!");
            }
        }
        else
        {
            // Sanity check for param1 is soft and if it fails we don't care and just return, but look how
            // far this return is from the check which causes it to be  
            return 0;
        }
    
        return result;
    }
    Of course it depends on the length of each branch body, but in the majority of cases error condition handlers are just going to be a return or throw an exception, and it is much more readable (from the point of view of the body of the function as well which doesn't end up stupidly indented) to reverse the check and return instead:
    public int exampleFunction(String param1, String param2)
    {
        int result;
    
        if (!someSanityCheckingFunction(param1))
        {
            return 0;
        }
    
        if (!someOtherSanityCheckingFunction(param2)
        {
            throw new Exception("Exception for failure of sanity check function 2 which clearly applies to the sanity check");
        }
    
        //
        // Function body
        //
    
        return result;
    }
    Obviously every situation is different, and that's why rigid adherence to the ideas they teach you when you learn to code sometimes isn't always the best strategy. Going back to the script we were talking about, in this instance - when you take into account the execution scheme of the language you're using - using STOP is much more efficient and actually more readable. Breaking isn't always bad.

    Quote from Zelfana
    A bit more questions about the waits; do you really need 10 tick waits, I have 2 ticks now and it seems fine to me? Also, do you need to wait after getslot or pick that would store a variable you want to check with an if? And for how long, the same 2 ticks I have which I have already done?

    You don't need 10 tick waits, but anything which interacts with the server may benefit from breathing room, use whatever works for you. No you don't need to wait after GETSLOT or PICK.

    Quote from Zelfana
    I didn't try the daemon idea yet but wouldn't that cause lag in itself as it would be a constant macro running on every tick? I find the game starts to lag a bit if I have multiple macros running that have loops running on every tick. And I would need to have multiple macro keys checked for, too, and that would most likely lag.

    Even on the crummiest PC I own I can run 20+ macros with tight loops so you should be fine unless your PC is powered by steam. IF doesn't have any efficiency hits based on the complexity of the expression, multiple IFs are worse than one but a single IF can be as complex as you like and the efficiency is the same.

    Quote from Zelfana
    As an extra question/request I ask if it's possible to get entities' other data besides their ID? Like the color of a sheep or the profession of a villager etc.

    Not yet.

    Quote from Zelfana
    Yeah I basically already did that but you have to keep nesting ELSE's after IFMATCHES to get multiple of these pseudo ELSEIFMATCHES.

    Added to wish list.

    Quote from Zelfana
    That doesn't help because when the macro starts twice both of the instances clear that check. The keypress is fired twice by Minecraft but the two keypresses happen on the same tick and that makes it impossible to halt the second macro within the macro itself. Am I really the only one with this problem of lag spikes? Can't be, this is the same exact problem as blocks being placed twice when you only clicked once.

    It's an issue with LWJGL, there's not much that can be done about it. Like I say I'll try to figure a way to implement debounce for certain keys, or at least some kind of mutex.
  • #4147
    As many people already reported, Macro mod isn't loading for me. When I try to enable it, it freezes on the Mojang logo screen forever.
    • Correct version of Litemod confirmed.
    • Correct version of macro mod.litemod confirmed, manually placed on the mods folder.
    • Tried with Magic Launcher and editing directly the jar, removing meta-inf properly.
    • Java 1.6
    • OSX 10.8.2
    • MagicLauncher 1.0.0

    Ideas? :unsure:
  • #4148
    Quote from Mumfrey

    You can only really round using a regex, but it's not a complicated one:
    MATCH(%#value%,"^([\d,]+")(\.\d+)?$",&value,1);SET(#value,%&value%);

    But the XPOS, YPOS and ZPOS are all integers anyway, in fact all numeric values used by the mod are integers. The macro you posted above would actually just try to teleport you to your own position, well it would provided it was inside an ECHO. If you just put that in as a chat command the server would probably choke on the raw string "/tp %PLAYER% %XPOS% %YPOS% %ZPOS%".


    Sorry, I wasn't really awake when I typed that, I'm trying to do this:
    KeyBind:
    $${$$<Pos.txt>;ECHO(/tp %PLAYER% #x #y #z)}$$

    Pos.txt:
    #x = %XPOS% + $$[incx]
    #y = %YPOS% + $$[incy]
    #z = %ZPOS% + $$[incz]

    Why does this fail with above error? I don't even input any values, just 0, 0, and 0 but it still fails.
    I support RedPower and LiteLoader!


  • #4149
    Quote from Mumfrey

    If I do I want to make sure it has a different syntax to normal assignments. What about something like:
    %#var% <= HEALTH

    or the Pascal-style:
    %#var% := HEALTH

    Either of those sound okay?


    I was thinking more of something like..

    Idea 1)
    %@&moneyof%@&player%%
    It would detect the & and the @& after each % sign, so it knows not to close off the first variable. We could always make a command so it knows not to close it off so you don't have to rewrite everything..
    a log special, echo special, and set special?
    LOGSPEC("&c%&&moneyof%@&player%%")
    SETSPEC(@&moneyof%@&player%,%@&lastmoney%)

    Idea 2 (more plausible))
    Make another type of variable quotes that parses first, before %@&blah%
    Maybe like %@&blah:@&player:% ?
    :@&player: would basically be a variable %%, and it would take from the same variable storage place, it would just make it parse first. So if %@&player% was MeepDarknessMeep, it would read it as %@&blahMeepDarknessMeep%.
    Thanks to Mumfrey for creating this awesome mod! The Macro / Keybind Mod. If you ever need to contact me asap, go to the server: mc.synapsehlp.com
  • #4150
    Quote from kiarules

    Sorry, I wasn't really awake when I typed that, I'm trying to do this:
    KeyBind:
    $${$$<Pos.txt>;ECHO(/tp %PLAYER% #x #y #z)}$$

    Pos.txt:
    #x = %XPOS% + $$[incx]
    #y = %YPOS% + $$[incy]
    #z = %ZPOS% + $$[incz]

    Why does this fail with above error? I don't even input any values, just 0, 0, and 0 but it still fails.

    You forgot to wrap it, ECHO doesn't expect to be served variables, it can output any literal string, so you must highlight them
    the same way you did with %PLAYER%, you can (should) just use PLAYER in IF(), but not in an Echo

    ECHO(/tp PLAYER #x #y #z)
    ECHO(/tp %PLAYER% #x #y #z)
    ECHO(/tp %PLAYER% %#x% %#y% %#z%)
    'Cause tomorrow spring is here
  • #4151
    Quote from Mumfrey

    If you're describing bugs please try to be descriptive, "does the whole thing with hitting esc where it pulls up the pause menu" assumes I have some prior knowledge of the issue which I do not. If there is a problem please describe it with steps to reproduce etc.


    The "That whole thing with the pause menu" he's talking about, is where, upon Right-clicking the Mob Spawner, and selecting the mob you wish to have spawn, you have to hit the "ESC" key, which both leaves the SpawnerGUI Menu, and then brings up the in-game menu as well. Resulting in users having to hit ESC twice, each time they have to change a Spawner.

    Honestly... I didn't even ~know~ how to set the mobs, and then get out of the GUI menu (I had to search for a while, to find that answer)... and did find it weird that Risugami bound the "exit" menu feature to a key, instead of placing a "X" somewhere, to click and close... or bind it (optionally) to the "Q" button (drop). But... it is what it is. Most people don't want to change their ESC key to something else, so they'll have to get used to it.

    Still... kind of weird to be talking about a SpawnerGUI issue, in the Macro Keybind thread...
    Last edited by xXTerra_BranfordXx: 10/30/2012 12:38:46 PM
    Want Some Colored Glass for [1.6.4]?
  • #4152
    I can't seem to use your mod on a server i go to anymore

    The game keeps randomly losing connection (everything freezes, can't open chests, furnaces; can't receive chat, eventually times out)
    either immediately at startup or within minutes
    I really didn't think it was your mod, but when i tried removing it it stopped
    and as soon as i put it back on it started happening again

    Since it's not a crash, i don't really know what kind of debug info to get..., any ideas?
    Last edited by Mart3323: 10/30/2012 3:00:42 PM
    'Cause tomorrow spring is here
  • #4153
    Quote from kiarules


    Sorry, I wasn't really awake when I typed that, I'm trying to do this:
    KeyBind:
    $${$$<Pos.txt>;ECHO(/tp %PLAYER% #x #y #z)}$$

    Pos.txt:
    #x = %XPOS% + $$[incx]
    #y = %YPOS% + $$[incy]
    #z = %ZPOS% + $$[incz]

    Why does this fail with above error? I don't even input any values, just 0, 0, and 0 but it still fails.


    #x = %XPOS% + $$[incx]

    You try to add a number to a string, because %% parses variables as a string. It should be just:
    #x = XPOS + $$[incx]


    ECHO(/tp %PLAYER% #x #y #z)

    Here you should add %% to the variables, like this:
    ECHO(/tp %PLAYER% %#x% %#y% %#z%)
    Last edited by Rene_Z: 10/30/2012 3:19:29 PM
  • #4154
    Quote from Mart3323

    I can't seem to use your mod on a server i go to anymore

    The game keeps randomly losing connection (everything freezes, can't open chests, furnaces; can't receive chat, eventually times out)
    either immediately at startup or within minutes
    I really didn't think it was your mod, but when i tried removing it it stopped
    and as soon as i put it back on it started happening again

    Since it's not a crash, i don't really know what kind of debug info to get..., any ideas?

    My only guess is you do not have permissions to use it on that server, and you have binds that have to do with these events. Perhaps the bind tries to fire and just causes issues?
    I go by DaleK ingame. Started minecraft ~July 7 2011
  • #4155
    Quote from RafaSKB

    As many people already reported, Macro mod isn't loading for me. When I try to enable it, it freezes on the Mojang logo screen forever.
    • Correct version of Litemod confirmed.
    • Correct version of macro mod.litemod confirmed, manually placed on the mods folder.
    • Tried with Magic Launcher and editing directly the jar, removing meta-inf properly.
    • Java 1.6
    • OSX 10.8.2
    • MagicLauncher 1.0.0

    Ideas? :unsure:

    Many people? I don't think anyone has reported problems with the 1.4 release other than small bugs, which have been fixed. Anyway, to your problem. Does the config file for the mod get generated? If so you could try enabling compatible mode in the config file to see whether it's a problem with the JInput system. Also check the liteloader.txt file for any clues.

    Still... kind of weird to be talking about a SpawnerGUI issue, in the Macro Keybind thread...

    Yeah, I wasn't sure what he was getting at either. I don't think it has anything to do with my mod.

    Quote from Mart3323

    I can't seem to use your mod on a server i go to anymore

    The game keeps randomly losing connection (everything freezes, can't open chests, furnaces; can't receive chat, eventually times out)
    either immediately at startup or within minutes
    I really didn't think it was your mod, but when i tried removing it it stopped
    and as soon as i put it back on it started happening again

    Since it's not a crash, i don't really know what kind of debug info to get..., any ideas?

    Have you got the chat filter installed? That would be my primary suspect for random stuff happening since it's the only major change between 0.9.4 and 0.9.5. Is it only on this one particular server you play on? Or is it just that you've only observed it happening on this one server?
    • Try disabling the chat filter if you are using it (just rename it and add something at the start of the filename because macros will only load modules that start with "module_"
    • Try enabling compatible mode and see if it makes any difference. I doubt it though for this kind of problem
    • Check liteloader.txt for startup errors that may indicate something is going wrong
    • Backup your macros.txt and then delete/rename it, just to be sure there's not a specific macro causing the issue.
  • #4156
    Ok 2 things one is can you add a option to clear the creative inv and also a way to connect to a server. Also one more thing is how do you display a list in a script file? I could never get $$[Option1,2,3]] to work.
  • #4157
    Quote from YukonAppleGeek

    Ok 2 things one is can you add a option to clear the creative inv and also a way to connect to a server.

    Yes I can add an option to clear the creative inv, no there's no way to add an option to connect to a server, macros don't run in the GUI, I may add this in the future.

    Quote from YukonAppleGeek
    Also one more thing is how do you display a list in a script file? I could never get $$[Option1,2,3]] to work.

    List names can't have spaces in them, so the above won't work. It has to be:
    $$[name[list,of,options,here,"quote options if, they, contain, commas"]]
  • #4158
    "Yes I can add an option to clear the creative inv"

    What about a way to delete a particular item in a slot? like in survival mode... ? possible with server plugin?
    Server: mc.kraftzone.net Website: kraftzone.net

    Official Trailer: http://www.youtube.com/watch?v=P4vN366_94Y&hd=1
  • #4159
    Quote from Mart3323

    You forgot to wrap it, ECHO doesn't expect to be served variables, it can output any literal string, so you must highlight them
    the same way you did with %PLAYER%, you can (should) just use PLAYER in IF(), but not in an Echo

    ECHO(/tp PLAYER #x #y #z)
    ECHO(/tp %PLAYER% #x #y #z)
    ECHO(/tp %PLAYER% %#x% %#y% %#z%)


    I derped and typed it wrong, but I had forgotten the %% around the # vars.
    I support RedPower and LiteLoader!


  • #4160
    Ok, need more help:
    I have a buffered crafting script I'm working on, looks like this:
    KeyBind:
    //Conditional using CTRL as value
    True: $${$$<CraftAll.txt>}$$
    False: $${SET(&newiddmg,$$i:d);SET(&camt, $$[CraftingAmount]);$$<CraftHelp.txt>}$$
    CraftAll.txt:
    IF(@#craftbuf<1);LOG("No crafting to do.");STOP();ENDIF;
    IF(@#craftbuf>5);LOG("Invalid Crafting buffer number");STOP;ENDIF;
    IF(@waitforcraft);ELSE;LOG("Not ready to craft!");STOP();ENDIF;
    IF(HITID==58);
    FOR(#count,1,@#craftbuf);
    LOG(Crafting %#count%);
    IF(#count == 0);CRAFTANDWAIT(@&iddmg1,@#amt1);ENDIF;
    IF(#count == 1);CRAFTANDWAIT(@&iddmg2,@#amt2);ENDIF;
    IF(#count == 2);CRAFTANDWAIT(@&iddmg3,@#amt3);ENDIF;
    IF(#count == 3);CRAFTANDWAIT(@&iddmg4,@#amt4);ENDIF;
    IF(#count == 4);CRAFTANDWAIT(@&iddmg5,@#amt5);ENDIF;
    NEXT;
    UNSET(@waitforcraft);
    SET(@#craftbuf,0);
    LOG("Crafting all done!");
    ELSE;
    LOG("No crafting table!");
    ENDIF;
    CraftHelp.txt:
    INC(@#craftbuf);
    IF(@nocraft)
    LOG(&4Buffer full!)
    DEC(@#craftbuf)
    STOP();
    ENDIF;
    IF(@#craftbuf == 1)
    SET(@&iddmg1,&newiddmg)
    SET(@&amt1,&camt)
    ELSEIF(@#craftbuf == 2)
    SET(@&iddmg2,&newiddmg)
    SET(@&amt2,&camt)
    ELSEIF(@#craftbuf == 3)
    SET(@&iddmg3,&newiddmg)
    SET(@&amt3,&camt)
    ELSEIF(@#craftbuf == 4)
    SET(@&iddmg4,&newiddmg)
    SET(@&amt4,&camt)
    ELSEIF(@#craftbuf == 5)
    SET(@&iddmg5,&newiddmg)
    SET(@&amt5,&camt)
    SET(@nocraft);
    ENDIF;
    IF(~@waitforcraft)
    SET(@waitforcraft);
    ENDIF;
    LOG("Waiting for craft: %@waitforcraft%, CraftBuf at %@#craftbuf%.")

    I expect it to work, but this is what I get after doing R, inputting something then doing CTRL-R:

    Note that the @waitforcraft is never set, @#craftbuf increases properly, for loop is weird, and the STOP() command isn't working.
    I support RedPower and LiteLoader!


  • To post a comment, please or register a new account.
Posts Quoted:
Reply
Clear All Quotes