FEATURE: Randomiser command/template

Let’s say you are making a dice minigame. the outcome will always be specified by you, the coder not by chance. a randomiser code would change that. for example.

you are in a game of dice. there is 1 round. you beat the other player by scoring higher than them.

set diceGame
gain diceGameround1
@{randomInt(1,6)}

but let’s say we have the option to name functions based on the template we are making. so that would be;

@{randomIntdiceGameOppositePlayer(1,6)} ← this is the command where the randomiser does its thing

then whatever number the player lands on. lets do 1.

if(diceGameOppositePlayer(1)){

@overlay DICE blablabla

NARR
You landed on 1.
Choose your next move.
choice
“Abandon game”{
if(diceGameround1)
NARR
You lose the game.
gain lostdiceGameround1
}
“Roll.”{
gain diceGameround1roll1OppositePlayer

now the player rolls their dice

@{randomIntdiceGameCurrentPlayer(1,6)}

now whatever random number the player gets let’s say 2 but the opposite player scored 1 before

if(diceGameround1roll1OppositePlayer){

@overlay DICE blabla

NARR
You won!
gain diceGameround1CurrentPlayerWin

exit diceGame

the gains could work with if/else/elif and the point system whatever you are comfortable with

please bump, like, comment support because this took me way too long :skull:

edit: i know it’s complicated but if you are an advanced coder this helps a lot with minigames

7 Likes

This sounds like a great idea! Would be super fun for readers having their own unique outcome situations.
Support!

3 Likes

Support

1 Like

bump

bump😊

bump!!

bump

bump

This would be great as the randomiser I made can be a bit finicky sometimes.
You can try it out in my test story.

1 Like

just tested it really interesting after a few tries i kept getting the sams number can you dm me the code? i would love to play with it

That’s how you can tell it’s random. Sometimes the same number will crop up more than once in a row.

I changed the code a bit so it only needs one overlay, since all the other overlays are based on it, and you just need to change the character to whoever is keeping the points and use their character code for the score overlay part (in every loop).

Here's the code:
@COUNT =0
@overlay BUTTON create from ATTACK and overlay BUTTON opacity 1 and overlay BUTTON shifts to 12 142 and overlay BUTTON scales to 0.465 0.465
@overlay EXIT create text |bold,color:white,outline:black| Tap here to exit.
@overlay EXIT opacity 1 and overlay EXIT shifts to 50 452 and overlay EXIT scales to 3.815 3.815
@overlay TEXT1 create text |bold,color:white,outline:black| This is your random number:
@overlay TEXT1 opacity 1 and overlay TEXT1 shifts to 23 110 and overlay TEXT1 scales to 2.556 2.556
@overlay SCORE create text |bold,color:white,outline:black| [5716065717780480]
@overlay SCORE opacity 1 and overlay SCORE shifts to 151 69 and overlay SCORE scales to 4.281 4.281
@overlay TAP00 create from ATTACK and overlay TAP00 shifts to -300 142 and overlay TAP00 scales to 0.465 0.465
@overlay TAP01 create from ATTACK and overlay TAP01 shifts to -300 142 and overlay TAP01 scales to 0.465 0.465
@overlay TAP02 create from ATTACK and overlay TAP02 shifts to -300 142 and overlay TAP02 scales to 0.465 0.465
@overlay TAP03 create from ATTACK and overlay TAP03 shifts to -300 142 and overlay TAP03 scales to 0.465 0.465
@overlay TAP04 create from ATTACK and overlay TAP04 shifts to -300 142 and overlay TAP04 scales to 0.465 0.465
@overlay TAP05 create from ATTACK and overlay TAP05 shifts to -300 142 and overlay TAP05 scales to 0.465 0.465
@overlay TAP06 create from ATTACK and overlay TAP06 shifts to -300 142 and overlay TAP06 scales to 0.465 0.465
@overlay TAP07 create from ATTACK and overlay TAP07 shifts to -300 142 and overlay TAP07 scales to 0.465 0.465
@overlay TAP08 create from ATTACK and overlay TAP08 shifts to -300 142 and overlay TAP08 scales to 0.465 0.465
@overlay TAP09 create from ATTACK and overlay TAP09 shifts to -300 142 and overlay TAP09 scales to 0.465 0.465

&overlay TAP00 shifts to 12 142 then overlay TAP00 shifts to 12 142 in 0.1 then overlay TAP00 shifts to -300 142 then overlay TAP01 shifts to 12 142 then overlay TAP01 shifts to 12 142 in 0.1 then overlay TAP01 shifts to -300 142 then overlay TAP02 shifts to 12 142 then overlay TAP02 shifts to 12 142 in 0.1 then overlay TAP02 shifts to -300 142 then overlay TAP03 shifts to 12 142 then overlay TAP03 shifts to 12 142 in 0.1 then overlay TAP03 shifts to -300 142 then overlay TAP04 shifts to 12 142 then overlay TAP04 shifts to 12 142 in 0.1 then overlay TAP04 shifts to -300 142 then overlay TAP05 shifts to 12 142 then overlay TAP05 shifts to 12 142 in 0.1 then overlay TAP05 shifts to -300 142 then overlay TAP06 shifts to 12 142 then overlay TAP06 shifts to 12 142 in 0.1 then overlay TAP06 shifts to -300 142 then overlay TAP07 shifts to 12 142 then overlay TAP07 shifts to 12 142 in 0.1 then overlay TAP07 shifts to -300 142 then overlay TAP08 shifts to 12 142 then overlay TAP08 shifts to 12 142 in 0.1 then overlay TAP08 shifts to -300 142 then overlay TAP09 shifts to 12 142 then overlay TAP09 shifts to 12 142 in 0.1 then overlay TAP09 shifts to -300 142 loop infinite times

label loop_0
@overlay SCORE clear
@overlay SCORE create text |bold,color:white,outline:black| [5716065717780480]
@overlay SCORE opacity 1 and overlay SCORE shifts to 155 77 in zone 1 and overlay SCORE scales to 2.306 2.306
@overlay SCORE shifts to 151 69 in zone 1 in 0.2 and overlay SCORE scales to 4.281 4.281 in 0.2

tappable
"TAP00" {
@COUNT =0
goto loop_0
}
"TAP01" {
@COUNT =1
goto loop_1
}
"TAP02" {
@COUNT =2
goto loop_2
}
"TAP03" {
@COUNT =3
goto loop_3
}
"TAP04" {
@COUNT =4
goto loop_4
}
"TAP05" {
@COUNT =5
goto loop_5
}
"TAP06" {
@COUNT =6
goto loop_6
}
"TAP07" {
@COUNT =7
goto loop_7
}
"TAP08" {
@COUNT =8
goto loop_8
}
"TAP09" {
@COUNT =9
goto loop_9
}
"EXIT" {
goto random_number_generator_end
}

label loop_1
@overlay SCORE clear
@overlay SCORE create text |bold,color:white,outline:black| [5716065717780480]
@overlay SCORE opacity 1 and overlay SCORE shifts to 155 77 in zone 1 and overlay SCORE scales to 2.306 2.306
@overlay SCORE shifts to 151 69 in zone 1 in 0.2 and overlay SCORE scales to 4.281 4.281 in 0.2

tappable
"TAP00" {
@COUNT =1
goto loop_0
}
"TAP01" {
@COUNT =2
goto loop_1
}
"TAP02" {
@COUNT =3
goto loop_2
}
"TAP03" {
@COUNT =4
goto loop_3
}
"TAP04" {
@COUNT =5
goto loop_4
}
"TAP05" {
@COUNT =6
goto loop_5
}
"TAP06" {
@COUNT =7
goto loop_6
}
"TAP07" {
@COUNT =8
goto loop_7
}
"TAP08" {
@COUNT =9
goto loop_8
}
"TAP09" {
@COUNT =0
goto loop_9
}
"EXIT" {
goto random_number_generator_end
}

label loop_2
@overlay SCORE clear
@overlay SCORE create text |bold,color:white,outline:black| [5716065717780480]
@overlay SCORE opacity 1 and overlay SCORE shifts to 155 77 in zone 1 and overlay SCORE scales to 2.306 2.306
@overlay SCORE shifts to 151 69 in zone 1 in 0.2 and overlay SCORE scales to 4.281 4.281 in 0.2

tappable
"TAP00" {
@COUNT =2
goto loop_0
}
"TAP01" {
@COUNT =3
goto loop_1
}
"TAP02" {
@COUNT =4
goto loop_2
}
"TAP03" {
@COUNT =5
goto loop_3
}
"TAP04" {
@COUNT =6
goto loop_4
}
"TAP05" {
@COUNT =7
goto loop_5
}
"TAP06" {
@COUNT =8
goto loop_6
}
"TAP07" {
@COUNT =9
goto loop_7
}
"TAP08" {
@COUNT =0
goto loop_8
}
"TAP09" {
@COUNT =1
goto loop_9
}
"EXIT" {
goto random_number_generator_end
}

label loop_3
@overlay SCORE clear
@overlay SCORE create text |bold,color:white,outline:black| [5716065717780480]
@overlay SCORE opacity 1 and overlay SCORE shifts to 155 77 in zone 1 and overlay SCORE scales to 2.306 2.306
@overlay SCORE shifts to 151 69 in zone 1 in 0.2 and overlay SCORE scales to 4.281 4.281 in 0.2

tappable
"TAP00" {
@COUNT =3
goto loop_0
}
"TAP01" {
@COUNT =4
goto loop_1
}
"TAP02" {
@COUNT =5
goto loop_2
}
"TAP03" {
@COUNT =6
goto loop_3
}
"TAP04" {
@COUNT =7
goto loop_4
}
"TAP05" {
@COUNT =8
goto loop_5
}
"TAP06" {
@COUNT =9
goto loop_6
}
"TAP07" {
@COUNT =0
goto loop_7
}
"TAP08" {
@COUNT =1
goto loop_8
}
"TAP09" {
@COUNT =2
goto loop_9
}
"EXIT" {
goto random_number_generator_end
}

label loop_4
@overlay SCORE clear
@overlay SCORE create text |bold,color:white,outline:black| [5716065717780480]
@overlay SCORE opacity 1 and overlay SCORE shifts to 155 77 in zone 1 and overlay SCORE scales to 2.306 2.306
@overlay SCORE shifts to 151 69 in zone 1 in 0.2 and overlay SCORE scales to 4.281 4.281 in 0.2

tappable
"TAP00" {
@COUNT =4
goto loop_0
}
"TAP01" {
@COUNT =5
goto loop_1
}
"TAP02" {
@COUNT =6
goto loop_2
}
"TAP03" {
@COUNT =7
goto loop_3
}
"TAP04" {
@COUNT =8
goto loop_4
}
"TAP05" {
@COUNT =9
goto loop_5
}
"TAP06" {
@COUNT =0
goto loop_6
}
"TAP07" {
@COUNT =1
goto loop_7
}
"TAP08" {
@COUNT =2
goto loop_8
}
"TAP09" {
@COUNT =3
goto loop_9
}
"EXIT" {
goto random_number_generator_end
}

label loop_5
@overlay SCORE clear
@overlay SCORE create text |bold,color:white,outline:black| [5716065717780480]
@overlay SCORE opacity 1 and overlay SCORE shifts to 155 77 in zone 1 and overlay SCORE scales to 2.306 2.306
@overlay SCORE shifts to 151 69 in zone 1 in 0.2 and overlay SCORE scales to 4.281 4.281 in 0.2

tappable
"TAP00" {
@COUNT =5
goto loop_0
}
"TAP01" {
@COUNT =6
goto loop_1
}
"TAP02" {
@COUNT =7
goto loop_2
}
"TAP03" {
@COUNT =8
goto loop_3
}
"TAP04" {
@COUNT =9
goto loop_4
}
"TAP05" {
@COUNT =0
goto loop_5
}
"TAP06" {
@COUNT =1
goto loop_6
}
"TAP07" {
@COUNT =2
goto loop_7
}
"TAP08" {
@COUNT =3
goto loop_8
}
"TAP09" {
@COUNT =4
goto loop_9
}
"EXIT" {
goto random_number_generator_end
}

label loop_6
@overlay SCORE clear
@overlay SCORE create text |bold,color:white,outline:black| [5716065717780480]
@overlay SCORE opacity 1 and overlay SCORE shifts to 155 77 in zone 1 and overlay SCORE scales to 2.306 2.306
@overlay SCORE shifts to 151 69 in zone 1 in 0.2 and overlay SCORE scales to 4.281 4.281 in 0.2

tappable
"TAP00" {
@COUNT =6
goto loop_0
}
"TAP01" {
@COUNT =7
goto loop_1
}
"TAP02" {
@COUNT =8
goto loop_2
}
"TAP03" {
@COUNT =9
goto loop_3
}
"TAP04" {
@COUNT =0
goto loop_4
}
"TAP05" {
@COUNT =1
goto loop_5
}
"TAP06" {
@COUNT =2
goto loop_6
}
"TAP07" {
@COUNT =3
goto loop_7
}
"TAP08" {
@COUNT =4
goto loop_8
}
"TAP09" {
@COUNT =5
goto loop_9
}
"EXIT" {
goto random_number_generator_end
}

label loop_7
@overlay SCORE clear
@overlay SCORE create text |bold,color:white,outline:black| [5716065717780480]
@overlay SCORE opacity 1 and overlay SCORE shifts to 155 77 in zone 1 and overlay SCORE scales to 2.306 2.306
@overlay SCORE shifts to 151 69 in zone 1 in 0.2 and overlay SCORE scales to 4.281 4.281 in 0.2

tappable
"TAP00" {
@COUNT =7
goto loop_0
}
"TAP01" {
@COUNT =8
goto loop_1
}
"TAP02" {
@COUNT =9
goto loop_2
}
"TAP03" {
@COUNT =0
goto loop_3
}
"TAP04" {
@COUNT =1
goto loop_4
}
"TAP05" {
@COUNT =2
goto loop_5
}
"TAP06" {
@COUNT =3
goto loop_6
}
"TAP07" {
@COUNT =4
goto loop_7
}
"TAP08" {
@COUNT =5
goto loop_8
}
"TAP09" {
@COUNT =6
goto loop_9
}
"EXIT" {
goto random_number_generator_end
}

label loop_8
@overlay SCORE clear
@overlay SCORE create text |bold,color:white,outline:black| [5716065717780480]
@overlay SCORE opacity 1 and overlay SCORE shifts to 155 77 in zone 1 and overlay SCORE scales to 2.306 2.306
@overlay SCORE shifts to 151 69 in zone 1 in 0.2 and overlay SCORE scales to 4.281 4.281 in 0.2

tappable
"TAP00" {
@COUNT =8
goto loop_0
}
"TAP01" {
@COUNT =9
goto loop_1
}
"TAP02" {
@COUNT =0
goto loop_2
}
"TAP03" {
@COUNT =1
goto loop_3
}
"TAP04" {
@COUNT =2
goto loop_4
}
"TAP05" {
@COUNT =3
goto loop_5
}
"TAP06" {
@COUNT =4
goto loop_6
}
"TAP07" {
@COUNT =5
goto loop_7
}
"TAP08" {
@COUNT =6
goto loop_8
}
"TAP09" {
@COUNT =7
goto loop_9
}
"EXIT" {
goto random_number_generator_end
}

label loop_9
@overlay SCORE clear
@overlay SCORE create text |bold,color:white,outline:black| [5716065717780480]
@overlay SCORE opacity 1 and overlay SCORE shifts to 155 77 in zone 1 and overlay SCORE scales to 2.306 2.306
@overlay SCORE shifts to 151 69 in zone 1 in 0.2 and overlay SCORE scales to 4.281 4.281 in 0.2

tappable
"TAP00" {
@COUNT =9
goto loop_0
}
"TAP01" {
@COUNT =0
goto loop_1
}
"TAP02" {
@COUNT =1
goto loop_2
}
"TAP03" {
@COUNT =2
goto loop_3
}
"TAP04" {
@COUNT =3
goto loop_4
}
"TAP05" {
@COUNT =4
goto loop_5
}
"TAP06" {
@COUNT =5
goto loop_6
}
"TAP07" {
@COUNT =6
goto loop_7
}
"TAP08" {
@COUNT =7
goto loop_8
}
"TAP09" {
@COUNT =8
goto loop_9
}
"EXIT" {
goto random_number_generator_end
}

label random_number_generator_end
@overlay BUTTON clear
@overlay EXIT clear
@overlay TEXT1 clear
@overlay SCORE clear
@overlay TAP00 clear
@overlay TAP01 clear
@overlay TAP02 clear
@overlay TAP03 clear
@overlay TAP04 clear
@overlay TAP05 clear
@overlay TAP06 clear
@overlay TAP07 clear
@overlay TAP08 clear
@overlay TAP09 clear
2 Likes

thank youu