This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
billysback's profile picture

[TOOL] EStack - record your event que.

Started by billysback, 02 February 2013 - 11:27 AM
billysback #1
Posted 02 February 2013 - 12:27 PM
I, personally, cannot think of a single good use of this program. I thought there must be one so, evidently, made it.
Anyway - whether or not I think it necessary - I made it, so here it is.

What it does:
You start it up, use ComputerCraft as normal and press F12 once you want to stop recording your events.
It basically overrides os.pullEvent and os.pullEventRaw temporarily, but don't worry it does it safely (as far as I have tested)

How to use it:
just run it, then do what it tells you (enter the output file for the event stack, then enter the program you first want to run, leave this blank and you are taken back to the main menu because of an error)

Format of the event stack:
I can't really be bothered to explain it right now, but if you look at it you can probably work it out yourself…
I made a program which ques all of the events back from a file as well, which works, but it is also kind of pointless as the events don't seem to quite do anything yet.

Anyway, here are the downloads for the two:
http://pastebin.com/RxYGAYjy - EStack, use to record event stacks (or ques)
http://pastebin.com/Hkr6wJPf - RStack, use to run stacks, run it similarly to EStack

If anyone can actually think of a decent use for this, or thinks this is vaguely interesting, please respond to let me know :)/>
Grim Reaper #2
Posted 02 February 2013 - 12:45 PM


for i=1,#que do
j = j + 1
if j > 50 then
j = 0
sleep(0)
end
local event = que[i]
if #event == 1 then
os.queueEvent( event[1] )
elseif #event == 2 then
os.queueEvent( event[1] , event[2] )
elseif #event == 3 then
os.queueEvent( event[1] , event[2] , event[3] )
elseif #event == 4 then
os.queueEvent( event[1] , event[2] , event[3] , event[4])
end
end
end


The section in which you use an if-elseif ladder to queue events I feel could be replaced simply as:

os.queueEvent( unpack( event ) )

Other than that, I can understand how this might be useful to some people, so good job!
ArchAngel075 #3
Posted 02 February 2013 - 02:52 PM
might be usefull to send a series of saved events to a separate computer? perhaps rs.locks or a memory for turtles?

Actually looking at turtles, if you type the arrow keys and action keys(say to dig) for a turtle, and save the events you can make "saved" actions.

SavedActions is a nice idea :P/> Perfect for pre-planning a turtles movements without gps and self-navigation especially for teaching it a 9by9 XD