|
| 23 Aug 2015 11:00 AM |
say I have
for i = 1, 100 do --stuff end
I forgot how I could make it sometimes do something twice without waiting, to compensate for time lost, cos .3 is the limit, so if I wanted to do something faster than that, steven recommended me to sometimes do it twice without waiting, and I forgot what his code looked like, I can't even find it, since my "MyForums" inbox is flooded... how do I make it sometimes do it twice per time? so I want to do something 50 times per second, just as an example... how can I do it with this? I know, I feel so stupid for not just, not being able to do it by myself, but also for forgetting steven's code :/
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2015 11:01 AM |
| Your question caused my butt hole to bleed a gallon worth of blood. |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2015 11:04 AM |
whatever -_- would this work?
local last = 0 for i = 1, 100 do --stuff if i * .3 <= (1 / fireRate) * i then last = last + wait() end end end
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
| |
|
|
| 23 Aug 2015 11:05 AM |
READ! I said I want to do something 50 times per second, but wait() only allows like 33 times! and so I want to compensate at some stages of the loop for time lost -_- what's so hard to understand? -_-
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2015 11:07 AM |
put no wait
suport http://www.roblox.com/Forum/ShowPost.aspx?PostID=170559579 |
|
|
| Report Abuse |
|
|
| |
|
|
| 23 Aug 2015 11:08 AM |
try wait(0.02) that should work
suport http://www.roblox.com/Forum/ShowPost.aspx?PostID=170559579 |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2015 11:14 AM |
dudes... really... .3 is the limit for wait() :P
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2015 11:15 AM |
no
suport http://www.roblox.com/Forum/ShowPost.aspx?PostID=170559579 |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2015 11:16 AM |
no what?
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2015 11:18 AM |
| only way to go faster than 1/30th of a second is to use RenderStepped |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2015 11:18 AM |
local tick2 = tick() wait() print(tick()-tick2)
> 0.0348961353302
I think you might have messed up the decimal place there |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2015 11:20 AM |
local last_tick = tick() game:GetService("RunService").RenderStepped:connect(function() print(tick()-last_tick) last_tick = tick() end)
0.016360759735107 0.018282890319824 0.014783620834351 0.015764951705933 0.016812086105347
there's something small enough |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 23 Aug 2015 11:27 AM |
Modulo is the answer.
for i = 1,100 do if i%2 == 0 then wait() end -- waits every even number end |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2015 11:36 AM |
team, oh yeah, thnx for correcting me, but I'm using ServerScripts :P
chim, hmmm, have u tested this?
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2015 11:39 AM |
steven made me a new scripts although, this one for some reason fires from 8 to 20 rps :/
local fireDelay = 1/50 local fireTime = 0
while firing do fire() fireTime = fireTime + fireDelay if fireTime > 1/30 then wait(fireTime) fireTime = 0 end end
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2015 11:40 AM |
for i = 1, 100 do if i % 2 == 0 then wait() end --code end |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2015 11:50 AM |
bad thing is about % though, if I set my rps to some other number, it wont follow, meaning it's not compatible, meaning it's not what I want :/
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2015 04:55 PM |
for i = 1, 100 do if (i*some_number_that_will_make_it_work) % 2 == 0 then wait() end end |
|
|
| Report Abuse |
|
|
|
| 24 Aug 2015 08:57 AM |
and em, what do u suggest to make some_number_that_will_make_it_work? my math skills are down right now, I'm damn tired to think :/
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
| |
|
|
| 24 Aug 2015 11:38 AM |
| Guys, just don't use a wait. If you want to do it almost instantly, don't use a wait. For anything even over 100,000 iterations this is plausible. |
|
|
| Report Abuse |
|
|
|
| 24 Aug 2015 11:40 AM |
@jarod
depends how heavy le loop is I usually don't have loops unless i want a delay or i am doing something heavy |
|
|
| Report Abuse |
|
|
|
| 24 Aug 2015 12:40 PM |
I need wait()s though :/ a gun doesn't fire unlimited rps :/
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|