Discuss Scratch

Blood-And-Burn
Scratcher
34 posts

I need help with my random generator.

So, I'm making a warrior cat generator with lists and variables and it's going horribly wrong. Basically, the part that's glitching is that I have a list of ranks (leader, warrior, kit, etc.) that randomly generate a variable. So, I want to make that when the rank is kit, the mate and kit variables are set to None and the name is a random variable of the list of prefixes and the suffix is ‘kit’. This works fine. But when I want to do something simular to other ranks, like apprentices, nothing happens, even when I spell everything how it's supposed to be spelled and use the code that worked with the kit rank.

Does anyone know why this happens and how to fix this?
NormallyNormal
Scratcher
24 posts

I need help with my random generator.

Have you tried creating a list with each rank name? Like this:

Then you can
(item (pick random (1) to (length of [inventory v] :: list)) of [inventory v] :: list)
Each time you run that block it will give you a random word from the list
Just use a ranks list instead of a inventory list.

I'm normal. Most of the time. I'm normally normal.
Blood-And-Burn
Scratcher
34 posts

I need help with my random generator.

NormallyNormal wrote:

Have you tried creating a list with each rank name? Like this:

Then you can
(item (pick random (1) to (length of [inventory v] :: list)) of [inventory v] :: list)
Each time you run that block it will give you a random word from the list
Just use a ranks list instead of a inventory list.
Thanks for trying to help, but because it's a warriors generator It needs to generate a name from a list of suffixes and a list of prefixes, basically meaning that I only know how to combine them using a variable.
cbletson
Scratcher
15 posts

I need help with my random generator.

is this what you want to do?
set [rank v] to [kit]
add [shoes] to [list v]
add [pants] to [list v]
add [shirt] to [list v]
add [hat] to [list v]
add (join (rank) (pick random (1) to (length of [list v] :: list))) to [list 2 v]
asivi
Scratcher
1000+ posts

I need help with my random generator.

It is possible you want to share your work in progress, perhaps?


Blood-And-Burn
Scratcher
34 posts

I need help with my random generator.

asivi wrote:

It is possible you want to share your work in progress, perhaps?
I've added the rank code to a sprite in the project.
Here's the link to the project: https://scratch.mit.edu/projects/202775792/#player
I hope this clears it up a bit.

Powered by DjangoBB

Standard | Mobile