
-----------------------------------
sci23
Thu Dec 20, 2007 4:26 pm

procedure and else if statements
-----------------------------------
when i run this there is an error. how do i put else if statements in procedures? thanks for your help


procedure die
if die=die1 then
drawbox(300,50,200,150,7)
drawfilloval(250,100,10,10,7)
elsif
 die=die2 then
drawbox(300,50,200,150,7)
drawfilloval(285,135,10,10,7)
drawfilloval(215,65,10,10,7)
elsif
die=die3 then
drawbox(300,50,200,150,7)
drawfilloval(285,135,10,10,7)
drawfilloval(215,65,10,10,7)
drawfilloval(250,100,10,10,7)
elsif
die=die4 then
drawbox(300,50,200,150,7)
drawfilloval(285,135,10,10,7)
drawfilloval(215,65,10,10,7)
drawfilloval(285,65,10,10,7)
drawfilloval(215,135,10,10,7)
elsif
die=die5 then
drawbox(300,50,200,150,7)
drawfilloval(285,135,10,10,7)
drawfilloval(215,65,10,10,7)
drawfilloval(285,65,10,10,7)
drawfilloval(215,135,10,10,7)
drawfilloval(250,100,10,10,7)
elsif
die=die6 then
drawbox(300,50,200,150,7)
drawfilloval(285,135,10,10,7)
drawfilloval(215,65,10,10,7)
drawfilloval(285,65,10,10,7)
drawfilloval(215,135,10,10,7)
drawfilloval(215,100,10,10,7)
drawfilloval(285,100,10,10,7)
end if
end die

put "Rolled ", Rand.Int (die,1, 6)


-----------------------------------
Saad
Thu Dec 20, 2007 5:07 pm

RE:procedure and else if statements
-----------------------------------
What exactly are you trying to do?, as far as i know, you cant check if procedures are equal (Why would you anyway?)

-----------------------------------
Jestar
Thu Dec 20, 2007 5:41 pm

Re: procedure and else if statements
-----------------------------------
i would just make a different procedure for each die roll and call the procedure when it has the correct die roll.

-----------------------------------
Clayton
Thu Dec 20, 2007 6:11 pm

RE:procedure and else if statements
-----------------------------------
Why not create one procedure which takes a parameter for which value the die has been rolled?

-----------------------------------
Jestar
Thu Dec 20, 2007 8:11 pm

Re: procedure and else if statements
-----------------------------------
that works to :D
