
-----------------------------------
nuno_owns
Thu Jun 15, 2006 1:50 pm

help with a yahtzee game
-----------------------------------
my problem is that I can not get the dice to roll with the corresponding pictures. This is what I have now but it does not work.After my if statements at value it says "if must be boolean type".


procedure Dice
    randomize
    for dice_1 (1 , 6)
        if value := 1 then
            Pic.Draw (picDice1, 5, 18, picCopy)
        elsif value := 2 then
            Pic.Draw (picDice2, 5, 18, picCopy)
        elsif value := 3 then
            Pic.Draw (picDice3, 5, 18, picCopy)
        elsif value := 4 then
            Pic.Draw (picDice4, 5, 18, picCopy)
        elsif value := 5 then
            Pic.Draw (picDice5, 5, 18, picCopy)
        elsif value := 6 then
            Pic.Draw (picDice6, 5, 18, picCopy)
        end if
    end for
end Dice


Thanks for all your help![/code]

-----------------------------------
jamonathin
Thu Jun 15, 2006 2:11 pm


-----------------------------------
Well first of all for loops aren't written like

for dice_1 (1 , 6)

but like . .

for i: 1 .. 6


And secondly, we are comparing the values, not setting the values, so we dont use:

if value := 1 then 

but rather . .

if value = 1 then 

The " := " is for setting a value, not comparing.

-----------------------------------
neufelni
Thu Jun 15, 2006 2:12 pm


-----------------------------------
Your problem is that you are using :=. This is used in Turing to assign values to variables. For if statements you want to just use =.
