So I've been attempting to do something that seems a little bit complicated. It's also a little hard to explain, but I shall try my best. When using the
createMacro() function, it allows you to freely write macros and assign it to a token or wherever. Here's a problem, I'm trying to make the macro creation a little more "customizable". For example, I would use the
input() function and type in very specific values of my desire. Easily, I could type in a custom name that depends on said
input() function by doing something like this:
Code: Select all
[h:status=input("name")]
[h:abort(status)]
[h:createMacro(name, etc)]
As you can see here, writing this code will allow you to give the macro any name you desire by putting in a custom name into the
name field when the initial prompt pops up. But, let's say you also wanted to include more values such as
healhp and
healmp to alter how much HP or MP one would recover? As I've tested, the new macro would not be able to read values from another macro that technically would not exist. By the time the new macro is created, the old macro's values no longer exists because
healhp and
healmp are solely dependent on what you type in the
input() function. I will give a visual example below:
Code: Select all
[h:status=input("healhp","healmp","name")]
[h:abort(status)]
[h:createMacro(name,
"[h:healing1=json.get(macro.args, 'healhp')]
[h:healing2=json.get(macro.args, 'healmp')]
[h:jsonData=json.set('{}', 'healhp', healing1, 'healmp', healing2)]
[macro('healing@Lib:rules'): jsonData]"
)]
As you can see above, the code displayed is absolutely wrong. While there technically would be no error message, the code in the new macro will not function at all because of how the quotations are written and the
json.get() values being nonexistent. Originally, what I wanted to do is, whatever I type in the
healhp and
healmp field for
input(), that would be the amount of HP and MP recovered when the new macro is clicked on. (Assume that the
[macro("healing@Lib:rules"): jsonData] function does everything correctly.) I'm wondering, is what I'm trying to do impractical? Is there a work around for this? Perhaps a completely different function that will do what I'm trying to do? Or must I stop all progress and code this in a completely different way? If more information is required, please let me know. I know this might be rather confusing especially with my way of explaining things, but hopefully it is not too much. Your feedback will be much appreciated!
Also, before I finish off my questions, I wanted to know an extra bit of information, but when using the
removeMacro() function, would it be possible to make a macro delete itself as soon as it performs its necessary function? If so, how would I go about doing this without getting the "removeMacro(): You do not have permission to call this function." error, if possible? Thanks again.