Discuss, ask for help, share ideas, give suggestions, read tutorials, and tell us about bugs you have found with MicroMacro in here.
Do not post RoM-Bot stuff here. There is a subforum for that.
Forum rules
This is a sub-forum for things specific to MicroMacro.
This is not the place to ask questions about the RoM bot, which uses MicroMacro. There is a difference.
-
luonline
- Posts: 21
- Joined: Thu May 15, 2008 1:57 pm
#1
Post
by luonline » Tue Sep 02, 2008 7:50 pm
Code: Select all
function yrest(msec)
safeYield();
if( msec < 10 ) then (1)
rest(msec);
return;
else
sections = math.floor(msec / 100); -- split into 10msec sections (2)
...
end
Taking a closer look at this code in lib.lua, I think:
(1) this line should be "if( msec < 100 ) then"
(2) this comment should be "-- split into 100msec sections"
Right?
-
Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
#2
Post
by Administrator » Wed Sep 03, 2008 2:45 pm
You're absolutely right. I think I screwed that up when I was trying to split it into 10ms sections instead of 100, but then it caused some problems (yielding across C-boundaries). I'll rework it to allow 10ms sections if Coco is available, or fall back on 100ms sections otherwise.
Thanks for the bug report.
-
luonline
- Posts: 21
- Joined: Thu May 15, 2008 1:57 pm
#3
Post
by luonline » Wed Sep 03, 2008 3:16 pm
elverion wrote:Thanks for the bug report.
Forget about it.
Actually, we (all users) thank you for spending your time developing and improving this great tool!
-
luonline
- Posts: 21
- Joined: Thu May 15, 2008 1:57 pm
#4
Post
by luonline » Thu Sep 04, 2008 6:55 am
elverion wrote:I'll rework it to allow 10ms sections if Coco is available, or fall back on 100ms sections otherwise.
Just a suggestion of implementation:
Code: Select all
function yrest(msec)
safeYield();
local size;
if( cocoAvailable ) then
size = 10;
else
size = 100;
end
if( msec < size ) then
rest(msec);
return;
else
sections = math.floor(msec / size); -- split into sections
ext = math.mod(msec, size); -- any left overs...
for b = 1,sections do
rest(size);
safeYield();
end;
if( ext > 0 ) then
rest(ext);
end
end
end
Of course, it should be tested regarding those problems (yielding across C-boundaries).
Who is online
Users browsing this forum: No registered users and 2 guests