Topic category: User side tutorials
Ever wanted to call procedures with custom dependencies but don't know how? well now you can! Unlike my other post (https://mcreator.net/forum/97750/how-call-procedure-custom-variables-file-manager-plugin), custom values aren't just limited to strings, numbers, or booleans (json objects too if using File Manager plugin) and is more simple to follow!
Step 1: Create some kind of procedure you want custom dependencies on. As an example, this procedure will simply send a chat with the value of noomber
Step 2: in another procedure, create a local variable with the same name as the custom dependency added.
You're also going to want to add some extra procedure blocks just to define any extra dependencies you need (if it's not already showing under "Required Dependencies"). For example, I created a local a
entity variable just to define the target entity. You can always manually add the dependencies by editing and locking procedure code, but this works as well.
Step 3: Use a custom code snippet and put the following code in:
-
NameofProcedure.execute(insert dependencies here);
NameofProcedure
must be the exact name of the procedure you're executing, with "Procedure" added at the end. For example, since the procedure I made is named "Test", the custom code and dependencies are as such:TestProcedure.execute(entity, noomber);
Aaand.. you're done! Now, you can get more creative with procedures
P.S. when calling a procedure and getting the return value, use the other custom code snippet and remove the semicolon at the end
Update: technically you don't even need to do
TestProcedure.execute(entity, noomber);
, you could just doTestProcedure.execute(entity, 30);
and it will automatically make 30 the value for noomber, but making local variables would still be easier i thinkUpdate 2: The dependencies provided in the custom code snippet also have to be in the exact order as the list of required dependencies show
^ nevermind i was wrong,, my bad
(ACTUAL) Update 2:
world
always comes first (if required),x,y,z
is defined right after. after that, the list of dependencies are exactly as the list of required dependencies go from up to down.(procedure code for proof)
W tutorial, thanks for the help Redwire
This is great. Obviously still have to test it, but I'm currently still stuck on 2024.1 and this is a great way to write procedure parameters before their official addition.
Update: This works like a charm. Many thanks!