Razor question - can I recount inside a macro?

Discussion in 'Renaissance Discussion' started by Nikolaj, Aug 4, 2017.

  1. Nikolaj

    Nikolaj New Member

    Joined:
    Jun 29, 2017
    Messages:
    22
    Likes Received:
    13
    Can I somehow make razor recount main backpack through a razor-command?
  2. wylwrk

    wylwrk Well-Known Member

    Joined:
    Jun 18, 2015
    Messages:
    5,473
    Likes Received:
    8,963
    2017-08-04 16_24_23-Settings.png
    Nikolaj likes this.
  3. Nikolaj

    Nikolaj New Member

    Joined:
    Jun 29, 2017
    Messages:
    22
    Likes Received:
    13
    Thanks, I will try that :)
  4. Nikolaj

    Nikolaj New Member

    Joined:
    Jun 29, 2017
    Messages:
    22
    Likes Received:
    13
    I believe that did it :)
  5. GMF2

    GMF2 New Member

    Joined:
    Jun 11, 2017
    Messages:
    23
    Likes Received:
    21
    So why would one need to recount counters in razor? What I mean is in what situation would that be useful?
  6. Duz-luk

    Duz-luk Active Member

    Joined:
    Apr 1, 2015
    Messages:
    171
    Likes Received:
    120
    I'm wondering that too, because doesn't Razor auto update in real time?
  7. wylwrk

    wylwrk Well-Known Member

    Joined:
    Jun 18, 2015
    Messages:
    5,473
    Likes Received:
    8,963
    Yes ... sans any containers (or types) you've set to not auto count when added.
  8. Nikolaj

    Nikolaj New Member

    Joined:
    Jun 29, 2017
    Messages:
    22
    Likes Received:
    13
    I use it for mining and I have had problem smelting because razor miscounted, I guess that happens sometimes. The toruble is that if razor says that there is ore and reality that ore isn't there, macro exits. So thats what I am using it for :) I am unsure if it actually works.........now I try.....
  9. Duz-luk

    Duz-luk Active Member

    Joined:
    Apr 1, 2015
    Messages:
    171
    Likes Received:
    120
    When wait timers expire they terminate the macro. If you have it on loop, it'll go back to the top execution line I think.
    It sounds like you must be using a non-looped routine and its getting hung up on the wait timer and exiting out from that.

    If this is the case, try figuring out what you need to do keep that wait timer from getting hung.
  10. Duz-luk

    Duz-luk Active Member

    Joined:
    Apr 1, 2015
    Messages:
    171
    Likes Received:
    120
    also sometimes its best to replace a "wait for target" "wait for gump" with just a "Pause 1.00sec" wait.
    I have many macros where doing that cleared up the flow of execution
    Nikolaj likes this.
  11. Nikolaj

    Nikolaj New Member

    Joined:
    Jun 29, 2017
    Messages:
    22
    Likes Received:
    13
    That's exactly what I am doing since I have trouble calling other macros, which I would prefer. It hangs up macro (exits) when I actually have no iron but system believes that it has iron, then it tries to melt and waits for target and when target never comes it exits. Recounting actually fixed the issue.

    I do trouble though calling other macros inside my main macro. It seems to exit after calling sub-macro. But maybe you have an idea for what I could be doing wrong here? That would help alot! Since some of my macro-scripts are 900-1000 lines after I have inserted all my check and bla bla :)
  12. Duz-luk

    Duz-luk Active Member

    Joined:
    Apr 1, 2015
    Messages:
    171
    Likes Received:
    120
    hmm.. are you sure you are recalling back into main macro from the sub macro. You have to re-execute the main macro by using the hotkeys -> macros -> execute function while recording the sub macro.

    [​IMG]

    You can spaghetti code like this but are you sure you're doing this on both ends? Both main AND sub?
    Nikolaj likes this.
  13. Nikolaj

    Nikolaj New Member

    Joined:
    Jun 29, 2017
    Messages:
    22
    Likes Received:
    13
    I believe I do, but will it return from sub-macro and if you had something after your hiding (drums and whatever), would it continue from here, when submacro has finished executing?

    My point is can I make "modules" and when all the modules are done can I put them all together in a main macro where I call submacros inside?
  14. Duz-luk

    Duz-luk Active Member

    Joined:
    Apr 1, 2015
    Messages:
    171
    Likes Received:
    120
    No, if you call back from a sub to a main it will still start with the top line every time in the main. Razor is not robust enough to call embedded macros like they're methods or functions. The execution flows sequentially so you have to spaghetti code and plan ahead with checks that determine when said subs will execute.
  15. Duz-luk

    Duz-luk Active Member

    Joined:
    Apr 1, 2015
    Messages:
    171
    Likes Received:
    120
    I highly suggest you implement at least some recursion in your macros. Razor is at its most powerful when you incorporate loops, fors, etc.

Share This Page