|
I was wondering if there is an easier way to do this script instead making a bunch of if statements.
I have a bingo game and i am trying to make it where they call bingo,
instead of making a bunch of if's for each button (number) which there is like 25 buttons.
Is there an easier way if it checks if they got a bingo? |
|
|
(I didn't make the script yes because if there is no easier way then i am going to have to make a bunch of if statements. |
|
|
|
Like what i mean is like:
Make a if statement for each button in the row
like:
if script.Parent.Parent.TextButton.ImageLabel.Visible == true then
if script.Parent.Parent.Textbutton1.ImageLabel.Visible == true then
print("And so on")
end
end |
|
|
>Solution
:Don't be lazy. |
|
|
|
@super
I don't get pcall. Just read it on the wiki. |
|
|
@super
There is 25 buttons i just want to know if there is an easier way. In the script i am going to make the might be like 50+ if statements. |
|
|
Here is the locals i have
local i1 = script.Parent.Parent.ImageLabel.i1
local i2 = script.Parent.Parent.ImageLabel.i2
local i3 = script.Parent.Parent.ImageLabel.i3
local i4 = script.Parent.Parent.ImageLabel.i4
local i5 = script.Parent.Parent.ImageLabel.i5
local b1 = script.Parent.Parent.ImageLabel.b1
local b2 = script.Parent.Parent.ImageLabel.b2
local b3 = script.Parent.Parent.ImageLabel.b3
local b4 = script.Parent.Parent.ImageLabel.b4
local b5 = script.Parent.Parent.ImageLabel.b5
local n1 = script.Parent.Parent.ImageLabel.n1
local n2 = script.Parent.Parent.ImageLabel.n2
local n3 = script.Parent.Parent.ImageLabel.n3
local n4 = script.Parent.Parent.ImageLabel.n4
local n5 = script.Parent.Parent.ImageLabel.n5
local g1 = script.Parent.Parent.ImageLabel.g1
local g2 = script.Parent.Parent.ImageLabel.g2
local g3 = script.Parent.Parent.ImageLabel.g3
local g4 = script.Parent.Parent.ImageLabel.g4
local g5 = script.Parent.Parent.ImageLabel.g5
local o1 = script.Parent.Parent.ImageLabel.o1
local o2 = script.Parent.Parent.ImageLabel.o2
local o3 = script.Parent.Parent.ImageLabel.o3
local o4 = script.Parent.Parent.ImageLabel.o4
local o5 = script.Parent.Parent.ImageLabel.o5
|
|
KodranJoin Date: 2013-08-15 Post Count: 5330 |
topRow = {}
2ndtopRow = {}
3rdtopRow = {}
4thtopRow = {}
bottomRow = {}
for i, v in pairs (array of the spaces on bingo card) do
if v is on top row then
topRow[#topRow + 1] = true
end
if v is on 2nd top row then
2ndtopRow[#2ndtopRow + 1] = true
end
if v is on 3rd top row then
3rdtopRow[#3rdtopRow + 1] = true
end
if v is on 4th top row then
4thtopRow[#4thtopRow + 1] = true
end
if v is on bottom row then
bottomRow[#bottomRow + 1] = true
end
end
if #topRow >= 5 then
--bingo on top row
end
if #2ndtopRow >= 5 then
--bingo on 2nd top row
end
if #3rdtopRow >= 5 then
--bingo on 3rd top row
end
if #4thtopRow >= 5 then
--bingo on 4th top row
end
if #bottomRow >= 5 then
--bingo on bottom row
end
then you could do this also for columns |
|
|
O_O e_o
holy crap dude
i saw that and started crying |
|
128GBJoin Date: 2014-04-17 Post Count: 8056 |
How about having them select the spaces that give them a bingo, then only check the 5 selected if they are in a row |
|
|
What would be the array? (sorry don't know about that) |
|
|
And what do you mean by is on? what is it supposed to be changed to. |
|
|