Random Words with sets

I want to do something like that:
http://img826.imageshack.us/img826/6452/setsc.jpg

When you press play each set randomly places and in which set randomly chooses one of the words. Who can help me to write the code for that?

I think can i help you but i nid you explain me

I found it a little confusing, but it is what I think it is, it might be fun. I do suggust doing something a little simpler first.

You like somthing like this?


-- Use this function to perform your initial setup
function setup()
    -- numero alasar entre 1-8
    numero = math.random(1,8)
    -- tabla con las palabras
    palabras = {}
    palabras[1] = "palabra1"
    palabras[2] = "palabra2"
    palabras[3] = "palabra3"
    palabras[4] = "palabra4"
    palabras[5] = "palabra5"
    palabras[6] = "palabra6"
    palabras[7] = "palabra7"
    palabras[8] = "palabra8"
end

-- This function gets called once every frame
function draw()
    -- This sets a dark background color 
    background(40, 40, 50)
    -- This sets the line thickness
    strokeWidth(5)
    text(palabras[numero],300,400)
    -- Do your drawing here
    
end

What explanation do u need?

@Juanjo56 can you write proper code pls?

I thingk yeas but i nid that you tell me wat you want
The your what you want that they go out 8 groups with 6 words random?

@Juanjo56 I get it! Its all working :slight_smile: But! What you did I need 1-6 and I need 8 of them.

Cool :slight_smile:

@Juanjo56
Yea. For example.

Set 1:
Up
Down
Left
Right
Death
Life

Set 2:
Rock
House
Paper
Mouse
Cat
Lion

etc…

And this would be nice to make button “Shuffle Words”

know how I can do to make when wen i publish a code look clear?

Not really.
Here code look clear http://twolivesleft.com/Codea/Talk/discussion/621/newton-s-cradle

@Juanjo56 you need to type three tilde characters before and after your code block. If you take a look at the forum FAQ (near the top of the main forum page) you can see what this character looks like. :slight_smile:

ow yeas :slight_smile: thanks

-- Use this function to perform your initial setup 
function setup()     
-- numero alasar entre 1-8     
numero = math.random(1,8)     
-- tabla con las palabras     
palabras = {}     
palabras[1] = "palabra1"     
palabras[2] = "palabra2"     
palabras[3] = "palabra3"     
palabras[4] = "palabra4"     
palabras[5] = "palabra5"     
palabras[6] = "palabra6"     
palabras[7] = "palabra7"     
palabras[8] = "palabra8" 
end

-- This function gets called once every frame 
function draw()     
-- This sets a dark background color      
background(40, 40, 50)     
-- This sets the line thickness     
strokeWidth(5)     
text(palabras[numero],300,400)     
-- Do your drawing here      
end

(I just editted the original code comment and added the tildes)

thanks

This is the code

function setup()
-- Numeros para poner las palabras
numero1 = 1
numero2 = 1
numero3 = 1
numero4 = 1
numero5 = 1
numero6 = 1
numero7 = 1
numero8 = 1
-- creamos las tablas para los sets
set_1 = {}
set_2 = {}
set_3 = {}
set_4 = {}
set_5 = {}
set_6 = {}
set_7 = {}
set_8 = {}
-- insertamos las palabras del set 1
set_1 [1] = "word1 set1"
set_1 [2] = "word2 set1"
set_1 [3] = "word3 set1"
set_1 [4] = "word4 set1"
set_1 [5] = "word5 set1"
set_1 [6] = "word6 set1"
set_1 [7] = "word7 set1"
set_1 [8] = "word8 set1"
-- insertamos las palabras del set 2
set_2 [1] = "word1 set2"
set_2 [2] = "word2 set2"
set_2 [3] = "word3 set2"
set_2 [4] = "word4 set2"
set_2 [5] = "word5 set2"
set_2 [6] = "word6 set2"
set_2 [7] = "word7 set2"
set_2 [8] = "word8 set2"
-- insertamos las palabras del set 3
set_3 [1] = "word1 set1"
set_3 [2] = "word2 set1"
set_3 [3] = "word3 set1"
set_3 [4] = "word4 set1"
set_3 [5] = "word5 set1"
set_3 [6] = "word6 set1"
set_3 [7] = "word7 set1"
set_3 [8] = "word8 set1"
-- insertamos las palabras en el set 4
set_4 [1] = "word1 set4"
set_4 [2] = "word2 set4"
set_4 [3] = "word3 set4"
set_4 [4] = "word4 set4"
set_4 [5] = "word5 set4"
set_4 [6] = "word6 set4"
set_4 [7] = "word7 set4"
set_4 [8] = "word8 set4"
-- lo mismo con la 5, 6, 7, 8
set_5 [1] = "word1 set5"
set_5 [2] = "word2 set5"
set_5 [3] = "word3 set5"
set_5 [4] = "word4 set5"
set_5 [5] = "word5 set5"
set_5 [6] = "word6 set5"
set_5 [7] = "word7 set5"
set_5 [8] = "word8 set5"
-- 6
set_6 [1] = "word1 set6"
set_6 [2] = "word2 set6"
set_6 [3] = "word3 set6"
set_6 [4] = "word4 set6"
set_6 [5] = "word5 set6"
set_6 [6] = "word6 set6"
set_6 [7] = "word7 set6"
set_6 [8] = "word8 set6"
-- 7
set_7 [1] = "word1 set7"
set_7 [2] = "word2 set7"
set_7 [3] = "word3 set7"
set_7 [4] = "word4 set7"
set_7 [5] = "word5 set7"
set_7 [6] = "word6 set7"
set_7 [7] = "word7 set7"
set_7 [8] = "word8 set7"
-- 8
set_8 [1] = "word1 set8"
set_8 [2] = "word2 set8"
set_8 [3] = "word3 set8"
set_8 [4] = "word4 set8"
set_8 [5] = "word5 set8"
set_8 [6] = "word6 set8"
set_8 [7] = "word7 set8"
set_8 [8] = "word8 set8"
end
function draw()
    background(143, 143, 143, 255)
    -- Rectangulos de el fondo
    fill(45, 45, 45, 255)
    rect(50,570,100,50)
    rect(200,570,100,50)
    rect(350,570,100,50)
    rect(500,570,100,50)
    rect(50,470,100,50)
    rect(200,470,100,50)
    rect(350,470,100,50)
    rect(500,470,100,50)
    rect(300,200,100,50)
    -- texto
    fill(0, 23, 255, 255)
    text("set1",100,650)
    text("set2",250,650)
    text("set3",400,650)
    text("set4",550,650)
    text("set5",100,550)
    text("set6",250,550)
    text("set7",400,550)
    text("set8",550,550)
    text("mesclar",350,230)
    fill(127, 127, 127, 255)
    -- texto de los sets ejemplo numero1 = 1
    -- set_1[numero1] seria igual que set_1[1]
    text(set_1[numero1],100,600)
    text(set_2[numero2],250,600)
    text(set_3[numero3],400,600)
    text(set_4[numero4],550,600)
    text(set_5[numero5],100,500)
    text(set_6[numero6],250,500)
    text(set_7[numero7],400,500)
    text(set_8[numero8],550,500)
end
function touched(touch)
    -- si el touch.x es > o igual que 300 y touch.x es < o igual que 400 y touch.y > o 
    --igual que 200 y touch.y < o igual que 250 y touch.state igual que BEGAN randomise los numeros
    if touch.x >= 300 and touch.y >= 200 and touch.x <= 400 and touch.y <= 250 and touch.state == BEGAN then
        numero1 = math.random(1,8)
        numero2 = math.random(1,8)
        numero3 = math.random(1,8)
        numero4 = math.random(1,8)
        numero5 = math.random(1,8)
        numero6 = math.random(1,8)
        numero7 = math.random(1,8)
        numero8 = math.random(1,8)
    end
end

Yay! Awesome!