RecipeManager

RecipeManager

130k Downloads

Flag suggestion: random number

SoSeDiK opened this issue ยท 3 comments

commented

Can you add something like this, please?
@randomnumber a 1-100 => Generate a random number between 1 and 100 with ID a.
So then I can use it like this:

combine
@displayresult first
flint + flint
= 0% wood_sword
@name &rFlint sword
@lore &7Good for beginners
= wood_sword
@name &rFlint sword
@randomnubmer a 10-13 => 'a' equals 11, for example
@lore &7Durability: {a}/{a} => It would be "&7Durability: 11/11"

By the way, can I somehow realize this:
I have an item with "&7Durability: n/15" in lore. If n isn't 1 then I need to keep this item with @keepitem but change the lore to "&7Durability: n-1/15".

Also what about OR in regex? I used ingredient condition:
@ingredientcondition iron_nugget | lore regex:LOL|HAH
And I got this warning:
Warning: Flag @ingredientcondition has unknown argument: HAH
I tried quotes, but it doesn't work too.

commented

Now that the 1.13/1.14 update is out of the way, I should have a bit of time to look into these. I love the idea of the random number, but I have an idea to make it easier instead of using a flag.

The regex issue is going to be a bit more difficult to solve, but I'll look into it to see what can be done.

commented

Added both of these in v2.16.0, but just realized I missed an important point of the random number, having the same result being used more than once.

For regex, you can now use two pipes "||" and they will get replaced to the single pipe "|".

For random numbers in lores, here's the current status:
For @ItemName, @ItemLore, @Command, @Message, @Broadcast:

  • {rand #1-#2} Outputs a random integer between #1 and #2. Example: {rand 5-10} will output an integer from 5-10
  • {rand #1-#2, #3} Outputs a random number between #1 and #2, with decimal places of #3. Example: {rand 1.5-2.5, 2} will output a number from 1.50 to 2.50

I'll see what I can do about getting the same random number somehow.

commented

Latest release (v2.16.1) now has support for reusing random numbers with the following format:

  • {rand n} reuse a random output, where n is the nth {rand} used excluding this format.

That should cover everything in the original post, please feel free to create a new ticket if you have any issues.