Edslaw
|
  |
| Joined: 03 Nov 2008 |
| Total Posts: 145 |
|
|
| 08 Jul 2017 08:05 PM |
| math.randomseed(tick()) for i = 1,3 do hack = (math.random(100)) print (hack) if 95 <= hack <= 100 then print "rare item won!" elseif 25 <= hack <= ## ################# ##### ####### item won" elseif 15 <= hack <= 24 then print "semi-rare item won" elseif hack < 14 then -- ## ###### range print "uncommon item won!" end end _________________________________________________________ i want it to generate a number then print something depending on what range its in but it keeps thinking its a boolean.. please help |
|
|
| Report Abuse |
|
|
Edslaw
|
  |
| Joined: 03 Nov 2008 |
| Total Posts: 145 |
|
|
| 08 Jul 2017 08:07 PM |
| ok its not readable but remove the for i = 1,3 |
|
|
| Report Abuse |
|
|
Edslaw
|
  |
| Joined: 03 Nov 2008 |
| Total Posts: 145 |
|
| |
|
|
| 08 Jul 2017 08:09 PM |
dunoo what half of that says but here's an example
hack = math.random(1,100)
if hack >= 80 then print'>= 80' elseif hack >= 60 then print'>= 60" end
try to adjust accordingly i guess |
|
|
| Report Abuse |
|
|
Edslaw
|
  |
| Joined: 03 Nov 2008 |
| Total Posts: 145 |
|
| |
|
Edslaw
|
  |
| Joined: 03 Nov 2008 |
| Total Posts: 145 |
|
|
| 08 Jul 2017 08:15 PM |
| great now it keeps doing the same value over and over again |
|
|
| Report Abuse |
|
|
|
| 08 Jul 2017 08:39 PM |
| can ya post your whole code here |
|
|
| Report Abuse |
|
|
|
| 08 Jul 2017 08:40 PM |
try this
for i = 1,3,1 do math.randomseed(tick()) hack = math.random(0,100) ---- stuff ---- wait() end |
|
|
| Report Abuse |
|
|
Edslaw
|
  |
| Joined: 03 Nov 2008 |
| Total Posts: 145 |
|
|
| 08 Jul 2017 08:44 PM |
heres a pastebin
/7KupPnas
now im getting
21:42:53.386 - Workspace.Script:48: 'end' expected (to close 'for' at line 1) near eof |
|
|
| Report Abuse |
|
|
nullfeels
|
  |
| Joined: 31 Mar 2017 |
| Total Posts: 1215 |
|
|
| 08 Jul 2017 08:52 PM |
Move math.randomseed(tick() outside the loop. You only need to call it once at the start of the script. Also, it's missing a closing parenthesis. "math.randomseed(tick())".
And again here: "hack = (math.random(0,100)" remove that starting parenthesis "hack = math.random(0,100)".
Finally you're missing an "end" at the end of your long if/elseif statement. |
|
|
| Report Abuse |
|
|
Edslaw
|
  |
| Joined: 03 Nov 2008 |
| Total Posts: 145 |
|
|
| 08 Jul 2017 08:58 PM |
| i just destroyed the script lol now its even more messed up |
|
|
| Report Abuse |
|
|
|
| 09 Jul 2017 09:35 AM |
math.randomseed(tick()) -- randomize for i = 1,3 do -- after a function type thing, tab out everything in it to keep organization better hack = math.random(0,100) -- random num between 0,100 print(hack.." HACK") -- shows what hack is if hack <= 10 then -- if hack is LESS THAN or EQUAL TO 10 then print ' rare item ' print "rare item" elseif hack <= 20 then print "common item" elseif hack <= 30 then print "common item" elseif hack <= 40 then pr#####c#######tem" elseif hack <= 50 then print "unccommon item" elseif hack <= 60 then print "uncommon item"
elseif hack <= 70 then print "uncommon item" elseif hack <= 80 then print "semi-rare item" elseif hack <= 90 then print "semi-rare item" elseif hack <= 100 then print "extremely rare item" wait(1) -- wait 1 se######e#######a####o#####ut this wait at the top if you want it to wait 1 second before the first loop
end end ^^^^^ I put that together with some tips and explanations, but just saying, it looks like the way you're doing the <='s is messed up. you might want to try doing this:
math.randomseed(tick()) -- randomize for i = 1,3 do -- after a function type thing, tab out everything in it to keep organization better hack = math.random(0,100) -- random num between 0,100 print(hack.." HACK") -- shows what hack is if hack >= 50 then -- if hack is MORE THAN OR EQUAL TO 50##h####r##### #o######tem' print"really common item" elseif hack >= 20 then print'uncommon item' elseif hack >= 0 then print'rarest item' wait(1) -- wait 1 se######e#######a####o#####ut this wait at the top if you want it to wait 1 second before the first loop
end end
that way if hack is either 50 or anything between 50-100 then it's the common item, so basically 50 numbers worth of rarity if that makes sense, then if hack is 20 or 20-49 it's a rare item, 29 numbers worth of rarity, and then if hack>= 0 gives hack 20 numbers of rarity, you can adjust accordingly |
|
|
| Report Abuse |
|
|
|
| 09 Jul 2017 10:25 AM |
Here's your solution, I apologise on their behalf.
95 <= hack <= 100
That will only work as 95 <= hack and hack <= 100
Change anything similar to the solution I provided and you should be good to go.
|
|
|
| Report Abuse |
|
|
|
| 09 Jul 2017 10:51 AM |
| wow i totally skipped over that, i kinda didn't bother reading most of it due to the hashtags and formatting. i did provide some workin stuff in my last post tho ^_^ |
|
|
| Report Abuse |
|
|