Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Lines of Code Reduction with control variable?

0 views
Skip to first unread message

hastegutgemacht

unread,
Apr 15, 2008, 10:47:55 AM4/15/08
to
Hello,

I have a problem. I'm new to toolbook (TB 2004 SP2) and my script
looks like this:

to handle buttonClick
wurf of group "cube01" = random( 6 )
wurf of group "cube02" = random( 6 )
...
wurf of group "cube25" = random( 6 )

local int a
local int b
...
local int f

if wurf of group "cube01" = 1
put a+1 into a
end
...
if wurf of group "cube25" = 1
put a+1 into a
end

---

if wurf of group "cube01" = 2
put b+1 into b
end
...
if wurf of group "cube25" = 2
put b+1 into b
end

--

if wurf of group "cube01" = 3
put c+1 into c
end
...
if wurf of group "cube25" = 3
put c+1 into c
end

--

if wurf of group "cube01" = 4
put d+1 into d
end
...
if wurf of group "cube25" = 4
put d+1 into d
end

--

if wurf of group "cube01" = 5
put e+1 into e
end
...
if wurf of group "cube25" = 5
put e+1 into e
end

--

if wurf of group "cube01" = 6
put f+1 into f
end
...
if wurf of group "cube25" = 6
put f+1 into f
end

text of Field "1-1" = a
text of Field "1-2" = b
text of Field "1-3" = c
text of Field "1-4" = d
text of Field "1-5" = e
text of Field "1-6" = f
forward

end buttonClick

It works, but it's not the best solution. Can anybody help me to
reduce the lines of code?

Kathrin

0 new messages