fxDreema

    • Register
    • Login
    • Search
    • Back to the main page
    • Categories
    • Recent
    • Tags
    • Popular
    • Search

    Current Block number in Custom Blocks

    Questions & Answers
    2
    3
    1235
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      MetaTrader last edited by MetaTrader

      I am on switching from offline to online version and running in trouble with my custom blocks:

      There is a global variable
      int aLoopIndex[];

      and here the source of my loop block which worked in Desktop version:

      int This_Block_Id = FXD_CURRENT_FUNCTION_ID;

      if (ArraySize(aLoopIndex) < (This_Block_Id +1)) {
      ArrayResize(aLoopIndex,(This_Block_Id + 1));
      }

      for (int i = 0; i < Cycles; i++) {
      aLoopIndex[This_Block_Id] = i;
      ~next~
      }
      aLoopIndex[This_Block_Id] = -1;
      ~inext~


      Now in online Version FXD_CURRENT_FUNCTION_ID is not working anymore.

      What is the right variable to use instead?

      1 Reply Last reply Reply Quote 0
      • fxDreema
        fxDreema last edited by

        Try ~X~

        Better don't use those variables and functions that I created, because sometimes I change them. This ~X~ thing is semi-official, I may change it some day as well, but this is more unlikely. It gives you the block number. Or I'm not sure, to be honest :))) Because now there are at least two different sets of block numbers 🙂 But I'm currently using it in some blocks, for example in those Draw blocks:

        http://prntscr.com/hyj6r0

        1 Reply Last reply Reply Quote 0
        • M
          MetaTrader last edited by

          @fxdreema said in Current Block number in Custom Blocks:

          ly. It gives you the block number. Or I'm not sure, to be honest :))) Because now there are at least two different sets of block numbers 🙂 But I'm currently using

          Thanks I will modify my code. What do you think about taking my loop as a Standard Block
          I guess I am not allone with the need to have a simple loop and knowing the current iteration

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post

          Online Users

          M
          P
          R
          S
          E
          M
          P
          C

          18
          Online

          146.7k
          Users

          22.4k
          Topics

          122.6k
          Posts

          Powered by NodeBB Forums | Contributors