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

[solved] os.pullEvent not stopping program

Started by CreeperGoBoom, 30 May 2014 - 10:57 PM
CreeperGoBoom #1
Posted 31 May 2014 - 12:57 AM
take a look at:
http://pastebin.com/qufnLXtb

from line 148 to 181

maybe ive got the wrong understanding, but isn't os.pullEvent supposed to make the computer WAIT for an event? in my case "modem_message"

its getting to registering new command print then completely bypassing the os.pullEvent("modem_message") section, which is a critical part of function config

at the moment i don't have the server pc set up yet but I do have a response program ready to fire, i want the client to wait until I fire my response at it from the server pc

I must be missing something

edit: ill rephrase, server isn't coded fully but there's a response program on the server pc :D/>
Edited on 31 May 2014 - 08:33 AM
Bomb Bloke #2
Posted 31 May 2014 - 06:51 AM
maybe ive got the wrong understanding, but isn't os.pullEvent supposed to make the computer WAIT for an event? in my case "modem_message"

Sort of.

Loosely put, each system has an event queue, and events go in there over time. os.pullEvent() grabs whatever event is at the front of the queue and hands it to you.

Adding a filter makes it discard any events it finds until it gets the type specified, but it still otherwise acts the same way - if there's already an event in the queue of the requested type, then it returns it pretty much instantly. It doesn't discard it and wait for a new event of that type to occur.

Anyway, I reckon your issue here is that you're looking for the reply in "m", whereas you should be checking against "f".
CreeperGoBoom #3
Posted 31 May 2014 - 09:59 AM
edit: found out what it was, i had a piece of code on server which was literally bouncing the message right back at the client, hence my os.pullevent issue [solved]

thanks for the help bomb bloke :)/>

code updated fyi
Edited on 31 May 2014 - 08:35 AM