New Event
#1
Posted 30 November 2014 - 01:30 AM
Rougeminner
#2
Posted 30 November 2014 - 01:36 AM
#3
Posted 30 November 2014 - 02:36 AM
i want this event to have 5 arguments and be call rednet_ping. the args in queevnet make it sound like it triggers an event can you please post demonstration code
#4
Posted 30 November 2014 - 02:57 AM
I could certainly post another example, but not without re-iterating what the examples on the linked wiki page demonstrate. I suggest opening up the ComputerCraft archive and hunting down the rednet API file.
#5
Posted 30 November 2014 - 03:15 AM
event,arg1,arg2,arg3,arg4,arg5 = os.pullEvent(Raw)()
from this point arg1 is sender ID
arg2 is protocol
arg3 is timer
arg4 is packet
arg5 is timeout
#6
Posted 30 November 2014 - 03:21 AM
os.queueEvent( "rednet_ping", 5, "protocol", 0.5, {type = "ping"}, 200 )
would be received like so
local event, id, protocol, timer, packet, timeout = os.pullEvent()
though I'm not sure what the point of the 'timeout' arg is...
Edited by theoriginalbit, 30 November 2014 - 03:21 AM.
#7
Posted 30 November 2014 - 03:43 AM
#8
Posted 30 November 2014 - 03:49 AM
Edited by Rougeminner, 30 November 2014 - 03:49 AM.
#9
Posted 30 November 2014 - 03:49 AM
os.queueEvent( "rednet_ping", 5 ) local event, senderId = os.pullEvent()
#10
Posted 30 November 2014 - 04:04 AM
i want to send it like this rednet.ping(0, 'ping', os.startTimer(), "ping", [ ])
i am working on the rednet ping part so how do i make it fire rednet ping when it receives rednet.ping()
#11
Posted 30 November 2014 - 04:06 AM
#12
Posted 30 November 2014 - 04:10 AM
#13
Posted 30 November 2014 - 04:58 AM
#14
Posted 30 November 2014 - 06:25 AM
Edited by theoriginalbit, 30 November 2014 - 06:25 AM.
#15
Posted 30 November 2014 - 07:23 AM
When a computer boots, it runs bios.lua, and that starts the shell (CraftOS). But it also runs another function in parallel with the shell - rednet.run(), which constantly checks for modem events and then queues "rednet" events if suitable (not all modem traffic is intended to represent rednet traffic).
I suspect that whatever your overall goals are, you're probably better off creating some wrapper functions that make use of the existing rednet API functions, rather than trying to replace rednet altogether. For example, take a look at rednet.host() and rednet.lookup() - it's pretty easy to rig up a rudimentary "ping" system out of those.
#16
Posted 30 November 2014 - 08:26 PM
guess not
Edited by Rougeminner, 30 November 2014 - 08:26 PM.
2 user(s) are reading this topic
0 members, 2 guests, 0 anonymous users











