ID:160730
 
Make 1 random word appear to the person drawing.

Example:
var/list/words = list("Car","Bomb","Gun","Mouse","Dog","Cat")

client/verb
Draw()
//Some code to go here that would pock one word from the list above.
src << "Tell the 'drawer' the word"


How would I do something like that?

I could do something like:
client/verb
Draw()
random = rand(1,500)
if(random == 1)
word = "Car"
if(random == 2)
word = "Bomb"
if(random == 3)
word = "Gun"
if(random == 4)
word = "Mouse"
if(random == 5)
word = "Dog"
if(random == 6)
word = "Cat"
//etc...
src << "Draw: [word]"


But using a list seems more efficient (If you can do it by lists).
Look up either pick() or list indexes.
Howey wrote:
Make 1 random word appear to the person drawing.

Example:
> var/list/words = list("Car","Bomb","Gun","Mouse","Dog","Cat")
>
> client/verb
> Draw()
> //Some code to go here that would pock one word from the list above.
> src << "Tell the 'drawer' the word"
>

How would I do something like that?

I could do something like:
> client/verb
> Draw()
> random = rand(1,500)
> if(random == 1)
> word = "Car"
> if(random == 2)
> word = "Bomb"
> if(random == 3)
> word = "Gun"
> if(random == 4)
> word = "Mouse"
> if(random == 5)
> word = "Dog"
> if(random == 6)
> word = "Cat"
> //etc...
> src << "Draw: [word]"
>

But using a list seems more efficient (If you can do it by lists).


Holy cow pie... you're making it much more complicated than it needs to be. You already set up a list of words, true? All you need is one (count it, one) line:
pick(words)
and the DM compiler will automatically pick a random entry within that list (be it 5 words to 5 million) and set it to any var, like for instance
var/list/words = list("Car","Bomb") //...
var/DrawThis = pick(words)
src << "Draw \a [Drawthis]"

That is all you need. That's it! Nothing more. Capeesh?
In response to Sctjkc01
Sctjkc01 wrote:
Howey wrote:
Make 1 random word appear to the person drawing.

Example:
> > var/list/words = list("Car","Bomb","Gun","Mouse","Dog","Cat")
> >
> > client/verb
> > Draw()
> > //Some code to go here that would pock one word from the list above.
> > src << "Tell the 'drawer' the word"
> >

How would I do something like that?

I could do something like:
> > client/verb
> > Draw()
> > random = rand(1,500)
> > if(random == 1)
> > word = "Car"
> > if(random == 2)
> > word = "Bomb"
> > if(random == 3)
> > word = "Gun"
> > if(random == 4)
> > word = "Mouse"
> > if(random == 5)
> > word = "Dog"
> > if(random == 6)
> > word = "Cat"
> > //etc...
> > src << "Draw: [word]"
> >

But using a list seems more efficient (If you can do it by lists).


Holy cow pie... you're making it much more complicated than it needs to be. You already set up a list of words, true? All you need is one (count it, one) line:
pick(words)
and the DM compiler will automatically pick a random entry within that list (be it 5 words to 5 million) and set it to any var, like for instance
var/list/words = list("Car","Bomb") //...
> var/DrawThis = pick(words)
> src << "Draw \a [Drawthis]"

That is all you need. That's it! Nothing more. Capeesh?


Thanks, but I already has this figured out when PIF replied. Appreciate you trying to help me out though.