Started by
CluelessWanderer
on
Topic category: Help with Minecraft modding (Java Edition)
Is it possible to get the name of a procedure from a string variable and use it in a custom code snippet to call a the procedure specified by the variable?
Not that I know of (at the moment), no you cannot.
But you could set the variable to the name of the procedure by simply setting it to the name of the procedure (by actually typing out the procedure), and then using an if/elseif/else chain to recognize different values of the string and then calling different procedures. You could also use an integer variable to determine which procedure to call.
I appreciate the response, but that doesn't really work for what I was thinking of though. I'm working on making a card game, so my idea was I could create new procedures for new card effects and just have it get the name of the procedure from the card to do the effect. That way it's modular and I don't have to go in and add new stuff to the procedures to account for a new effect.
I suppose an if/elseif/else chain would be a good placeholder until a feature like that is added though. Thanks!
Yes, in your case it is a very inefficient way of calling procedures. I have a feeling (even though i can't code in text) that there would be a way to do it in text based format though.