Calling a procedure from another procedure should use the same local variables

Started by Ergosphere on

Topic category: Feature requests and ideas for MCreator

Joined Sep 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Calling a procedure from another procedure should use the same local variables

I made an advanced procedure to generate entirely random structures from predefined rooms. This ends up being close to 10k blocks in a procedure and I would like to lower this amount by having procedures being called to handle specific requests. This however isn't currently possible with how complicated the procedure is. If I would call a new procedure to handle certain functions it needs certain local variables to work. Global variables wouldn't work because multiple rooms generate at the same time and it wouldn't be truly random anymore. I also can't store NBT data because if I call a new procedure the new procedure wouldn't know which block to check for the NBT data.

If I add a new procedure I want to be able to create the same local variables inside of it and if I call the procedure it should use the same local variable data as the procedure that called it. Would like to hear the thoughts on the possibility of this.

Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Did you try to use Global…
Tue, 09/14/2021 - 17:08

Did you try to use Global Variables?

Joined Sep 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Global variables wouldn't…
Tue, 09/14/2021 - 22:28

Global variables wouldn't work. I have multiple rooms generating at the same time and it wouldn't make it truly random anymore because it would be using the same variable instead of generating a random one each time.

Joined Sep 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
And I'll be really honest…
Tue, 09/14/2021 - 22:31

And I'll be really honest this request isn't that extraordinary. This is normal in coding and it saves code. I really hope this would eventually get implemented to streamline a lot of things when making procedures.