|
| 01 Sep 2013 12:39 AM |
| A gui that pops up on everyone's screen, 3 options Easy, Medium, and Hard. After a certain amount of time it collects the votes and does a function in a script? But not a script inside the gui |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2013 12:42 AM |
| I could right the script, I just need like a basic understanding on what I need to do. Like make a script in the gui to collect the votes and I dont know da rest |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2013 12:53 AM |
| If you don't know how to do it, then you don't know how to write the script. I can't explain it unless a write a bunch of stuf, but I'm too lazy for that so. Just break it down, and go to the wiki for each part. Once you do all that tell me how you're going to script it then I'll correct you. |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2013 12:55 AM |
PlayerGui TextButtons LocalScript MAYBE IntValue to represent difficulties: 1 being Easy, 2 being Medium and so on. |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2013 12:57 AM |
Well, Lets say I have
EasyVoteValue = 4 MedVoteValue = 3 HardVoteValue = 7
How would I find the Highest one? |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2013 01:00 AM |
print(math.max(EasyVoteValue, MediumVoteValue, HardVoteValue))
Never used this before though |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2013 01:00 AM |
Now we're making progress!
EasyVoteValue = 4 MedVoteValue = 3 HardVoteValue = 7
if EasyVoteValue > MedVoteValue and EasyVoteValue > HardVoteValue then --stuff elseif MedVoteValue > EasyVoteValue and MedVoteValue > HardVoteValue then --stuff elseif MedVoteValue > HardVoteValue and EasyVoteValue > MedVoteValue then --stuff end
|
|
|
| Report Abuse |
|
|
|
| 01 Sep 2013 01:01 AM |
| Wow I've never even heard of math.max -.- I feel stupid. |
|
|
| Report Abuse |
|
|
your90
|
  |
| Joined: 06 Mar 2011 |
| Total Posts: 1380 |
|
|
| 01 Sep 2013 01:02 AM |
| Looool this is so advanced for me. ;o |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2013 01:02 AM |
Lel, I quickly checked wiki because I remembered seeing this.
http://wiki.roblox.com/index.php/Function_Dump/Mathematical_Functions#math.max
Also, The way you did it would take alot of work for some games with alot of vote buttons |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2013 01:03 AM |
function GetHighest(Table) local x,amount,tied,z=0,0,{} for i,v in pairs(Table)do if v>amount then amount,z=v,i tied={v} elseif v==amount then table.insert(tied,v) end end local y = math.random(#tied) return z, tied[y] end
local Table = {EasyVoteValue = 4, MedVoteValue = 3, HardVoteValue = 7}
print(GetHighest(Table))
>HardVoteValue 7 |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2013 01:04 AM |
LOL math.max conquers all. I wish I knew about this earlier. Such a simple line, yet so powerful. |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2013 01:05 AM |
> print(math.max(4, 20, 34, 17)) 34 Simple lel |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2013 01:05 AM |
| math.max is not helpful in this case. It will just return the highest number, but not actually give you which one won. |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2013 01:06 AM |
^^? Make it a variable instead of printing it.
highestvote = math.max(EasyVoteValue, MediumVoteValue, HardVoteValue) |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2013 01:07 AM |
| If you did that it would just give you a number, not actually any of "EasyVoteValue, MediumVoteValue, HardVoteValue". |
|
|
| Report Abuse |
|
|
your90
|
  |
| Joined: 06 Mar 2011 |
| Total Posts: 1380 |
|
| |
|
|
| 01 Sep 2013 01:09 AM |
| ...All we need is the number? |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2013 01:10 AM |
...
local X, Y, Z = 1, 2, 3
local Highest = math.max(X, Y, Z)
>3
We don't actually know if it's X, Y, or Z from the math.max function. Which means if we're trying to determine if it's Easy, Medium, or Hard that won, this function renders useless. |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2013 01:12 AM |
| Actually, You could loop through the Stored values and find the one with the same value that math.max printed. I am making it simple for him since he is just starting out. |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2013 01:14 AM |
So was this script ok at all?\
if EasyVoteValue > MedVoteValue and EasyVoteValue > HardVoteValue then --stuff elseif MedVoteValue > EasyVoteValue and MedVoteValue > HardVoteValue then --stuff elseif MedVoteValue > HardVoteValue and EasyVoteValue > MedVoteValue then --stuff end
|
|
|
| Report Abuse |
|
|
|
| 01 Sep 2013 01:16 AM |
Not this part elseif MedVoteValue > HardVoteValue and EasyVoteValue > MedVoteValue then |
|
|
| Report Abuse |
|
|
| |
|
|
| 01 Sep 2013 01:25 AM |
| THEN I SHALL MAKE A LOOP WITH MATH.MAX |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2013 01:27 AM |
| Its checking if the Medium vote is higher then the Hard vote but smaller then the Easy vote rather that being larger then both. |
|
|
| Report Abuse |
|
|