Help With Procedures - delay block [Solved]

Started by DragenSlayor on

Topic category: Help with MCreator software

Last seen on 19:28, 24. May 2019
Joined Jul 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Help With Procedures - delay block [Solved]
Mon, 11/19/2018 - 16:54 (edited)

Is there any way to wait in between each action in procedures? I'd like to know if theres a way.

Edited by DragenSlayor on Mon, 11/19/2018 - 16:54
Last seen on 05:15, 7. Jun 2018
Joined May 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You might try the custom…
Tue, 05/22/2018 - 13:19

You might try the custom code snippet (under advanced) and add

Thread.sleep(X);

Where "X" is number of milliseconds to wait. This appears to compile properly, but I cannot test operation.

Last seen on 17:49, 25. Mar 2021
Joined Jun 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I have already replied in…
Tue, 05/22/2018 - 21:25

I have already replied in the mcreator news, anyways, here is a copy+paste

Actually a procedure is a Minecraft tick (1/20 seconds), so the only way for doing so is adding a global variable, then adding something that makes the global variable increase at the end of the procedure and adding an "if" condition that checks the value of the variable, does something and resets the variable. Rember to put big numbers in the "if" condition (if you'll put 100 it will wait 5 seconds, 100:20=5) Sorry for bad English

Last seen on 23:54, 30. May 2018
Joined Oct 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
how to make it increase at…
Tue, 05/22/2018 - 21:39

how to make it increase at the end of the procedure?

 

Last seen on 23:54, 30. May 2018
Joined Oct 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
oh any way to make a…
Wed, 05/23/2018 - 01:32

oh any way to make a cooldownw procedure?

Last seen on 17:49, 25. Mar 2021
Joined Jun 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Set Variable x (GetVariable…
Wed, 05/23/2018 - 05:22

Set Variable x (GetVariable x +1)

Last seen on 23:54, 30. May 2018
Joined Oct 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
can u sed  me a pic?
Wed, 05/23/2018 - 20:13

can u sed  me a pic?

Last seen on 23:54, 30. May 2018
Joined Oct 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Bro Raol Plz answer OMG
Sat, 05/26/2018 - 06:52

Bro Raol Plz answer

OMG

Last seen on 05:15, 7. Jun 2018
Joined May 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I'm not in front of my…
Sat, 05/26/2018 - 10:15

I'm not in front of my computer but i think this is what he's getting at.

  1. under loops section, get "WHILE []"
  2. under logic section, get "[]<[]"
  3. under custom variables section, get "GET [custom variable]", put into first logic slot
  4. under math get "0", put into second logic slot, set to number ticks you want counted
  5. under custom variables section, get the option "SET [custom variable] =[]", put into loop thread
  6. under math section get "[]+[]", put into SET slot
  7. custom variables "GET [custom variable]", put into first + slot
  8. math "0", put into second + slot, set to 1
  9. logic "if[]", underneath-outside-after while loop
  10. logic "[]=[]" into IF slot
  11. GET custom variable into first logic slot
  12. math "0" into second logic slot, set to tick value you want event to happen
  13. put events into IF loop
  14. repeat 9-13 for each "warning" or timed event
Last seen on 05:15, 7. Jun 2018
Joined May 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
edit: step 2: put that logic…
Sat, 05/26/2018 - 10:16

edit: step 2: put that logic into the while slot.

Last seen on 05:15, 7. Jun 2018
Joined May 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
edit 2: step 9 and following…
Sat, 05/26/2018 - 10:31

edit 2: step 9 and following; on second thought, better put those if functions into the while loop. :weary: this whole thing inefficient and cludgy but if you're absolutely certain thread.sleep(X) won't work for your purposes...

my understanding is that thread.sleep() will count actual time and the while loop will count ticks. This means if the server is lagging, there might be a significant difference in amount of time measured.

Last seen on 23:54, 30. May 2018
Joined Oct 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
C:\Users\Feather\Desktop…
Sat, 05/26/2018 - 17:23

C:\Users\Feather\Desktop\MCreator179\forge\build\sources\main\java\mod\mcreator\mcreator_lol.java:26: error: incompatible types: possible lossy conversion from double to int
    mcreator_VarListtestenvironmentmod.One = ((double)(mcreator_VarListtestenvironmentmod.One+1));if ((mcreator_VarListtestenvironmentmod.One==100)) {if(entity instanceof EntityPlayerMP){
                                              ^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
 

i got a error

 

Last seen on 05:15, 7. Jun 2018
Joined May 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I can't tell if mcreator…
Sat, 05/26/2018 - 17:50

I can't tell if mcreator uses threading or if the mods are jammed into the main thread. I assumed multithreading but it looks like I'm wrong.

It looks like forge has a specific tick handling set of functions, but it will require editing the actual code, try reading through 

https://www.minecraftforum.net/forums/mapping-and-modding-java-edition/…

@feather4011 post a screenshot of your events? 

Last seen on 23:54, 30. May 2018
Joined Oct 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
gimme ur discord so i can…
Mon, 05/28/2018 - 20:54

gimme ur discord so i can sned it to u

Last seen on 01:16, 30. May 2018
Joined May 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
So the problem is that the…
Wed, 05/30/2018 - 01:13

So the problem is that the variable that you mention to make a cooldown system is local, which means it can only be called in that procedure. Which also means that even if you have the while loop counting down, that number is basically void after the procedure is done or is called again since the while loop would keep on resetting it self. Which leads to the other problem regarding variables in MCreator, the only 2 type of variables that you can use are local and global both of which cant be used to specify a variable for one object or player. I have tried this before and my only other solution is making a some sort of item that prohibits the player from using the ability or what ever is on cooldown.