Jump to content




[1.5+] Dark Chat - rednet chat program! (Works on 1.6+)


  • You cannot reply to this topic
33 replies to this topic

#21 momona5

  • Members
  • 14 posts

Posted 17 March 2013 - 07:01 AM

I've been trying for a while to make the chat program run something after, but I'm not sure how to do this. Help? I tried changing a couple things, but I'm not sure how your code works exactly with the whole "/exit" thing.

#22 FuuuAInfiniteLoop(F.A.I.L)

  • Banned
  • 435 posts
  • LocationThe left part of this post

Posted 17 March 2013 - 07:58 AM

for channels you can modify you recieve and send functions o the channel can be a text!!

#23 YoYoYonnY

  • Members
  • 49 posts

Posted 19 March 2013 - 08:43 AM

View Postmomona5, on 25 February 2013 - 05:22 AM, said:

uhmmm. So I'm not sure why, but I'm on my friends server with this chat and whenever i join, leave, or chat, it says it twice...

Posted Image
I think you are printing it first.
Delete that line
(For example:
input = read()
print(input)
rednet.send(input)
rednet.receive()
)
delete 'print(input)' here

#24 darkrising

  • Members
  • 234 posts
  • LocationScotland

Posted 19 March 2013 - 12:39 PM

View Postmomona5, on 17 March 2013 - 07:01 AM, said:

I've been trying for a while to make the chat program run something after, but I'm not sure how to do this. Help? I tried changing a couple things, but I'm not sure how your code works exactly with the whole "/exit" thing.

When you type '/exit' the function is called in the commands table (comD), it then queues the event 'exit' which the function 'exitEventListen' is waiting for, when that function returns it causes parallel function to also return, exiting the program.

If you wanted to run a program on exit, you could either add shell.run("<program name>") right at the bottom under parallel or add another function in to run after the parallel function has returned.

Hope this helps :)


View Posturielsalis, on 17 March 2013 - 07:58 AM, said:

for channels you can modify you recieve and send functions o the channel can be a text!!
Kinda like a label instead of number type thing? I could do something like that.


View PostYoYoYonnY, on 19 March 2013 - 08:43 AM, said:

View Postmomona5, on 25 February 2013 - 05:22 AM, said:

uhmmm. So I'm not sure why, but I'm on my friends server with this chat and whenever i join, leave, or chat, it says it twice...

I think you are printing it first.
Delete that line
(For example:
input = read()
print(input)
rednet.send(input)
rednet.receive()
)
delete 'print(input)' here

This was fixed ages ago...

#25 momona5

  • Members
  • 14 posts

Posted 26 March 2013 - 07:45 AM

View Postdarkrising, on 19 March 2013 - 12:39 PM, said:

View Postmomona5, on 17 March 2013 - 07:01 AM, said:

I've been trying for a while to make the chat program run something after, but I'm not sure how to do this. Help? I tried changing a couple things, but I'm not sure how your code works exactly with the whole "/exit" thing.

When you type '/exit' the function is called in the commands table (comD), it then queues the event 'exit' which the function 'exitEventListen' is waiting for, when that function returns it causes parallel function to also return, exiting the program.

If you wanted to run a program on exit, you could either add shell.run("<program name>") right at the bottom under parallel or add another function in to run after the parallel function has returned.

Hope this helps :)

- snip -



I tried tweaking this part. Gives me an error when i open some other things and has a little blinking cursor even when other programs are running.


function exitEventListen()
  while true do
	os.pullEvent("exit")
	modem.closeAll()
	term.clear()
	term.setCursorPos(1,1)
	shell.run("/mrom/menus/rednet")
	return exit
  end
end

also tried this



function exitEventListen()
  while true do
	os.pullEvent("exit")
	modem.closeAll()
	term.clear()
	term.setCursorPos(1,1)
	return
	shell.run("/mrom/menus/rednet")
  end
end



EDIT: The error it gave me was this:
parallel:22: serialize:1: attemp to index ? (a nil value)


#26 spyman68

  • Members
  • 155 posts

Posted 26 March 2013 - 07:56 AM

You should check out Nova IRC

#27 darkrising

  • Members
  • 234 posts
  • LocationScotland

Posted 27 March 2013 - 08:22 AM

--derp double post... ---

#28 darkrising

  • Members
  • 234 posts
  • LocationScotland

Posted 27 March 2013 - 08:24 AM

View Postmomona5, on 26 March 2013 - 07:45 AM, said:

-snip-

Line 308:
  ["exit"] = {
	run = function()
	  rSend("has quit.", true)
	  os.queueEvent("exit")
	end,
	help = ""
  },

try:
  ["exit"] = {
	run = function()
	  rSend("has quit.", true)
	  os.queueEvent("exit")
	 shell.run("/mrom/menus/rednet")
	end,
	help = ""
  },


#29 momona5

  • Members
  • 14 posts

Posted 01 April 2013 - 08:30 AM

View Postdarkrising, on 27 March 2013 - 08:24 AM, said:

View Postmomona5, on 26 March 2013 - 07:45 AM, said:

-snip-
-snip-
I tried that and it just exits when I type /exit
and I have no clue why



EDIT: by exit, I mean it just drops you into the terminal and doesn't run the program.

#30 darkrising

  • Members
  • 234 posts
  • LocationScotland

Posted 02 April 2013 - 09:17 PM

View Postmomona5, on 01 April 2013 - 08:30 AM, said:

View Postdarkrising, on 27 March 2013 - 08:24 AM, said:

View Postmomona5, on 26 March 2013 - 07:45 AM, said:

-snip-
-snip-
I tried that and it just exits when I type /exit
and I have no clue why



EDIT: by exit, I mean it just drops you into the terminal and doesn't run the program.

Okay, I'll look into it.

#31 encrypted

  • Members
  • 3 posts

Posted 02 July 2013 - 11:38 AM

Can you add a function to change your nickname by typing /nick followed by your username?

#32 darkrising

  • Members
  • 234 posts
  • LocationScotland

Posted 02 July 2013 - 04:14 PM

View Postencrypted, on 02 July 2013 - 11:38 AM, said:

Can you add a function to change your nickname by typing /nick followed by your username?

As you requested, I have now added this in :)

#33 encrypted

  • Members
  • 3 posts

Posted 02 July 2013 - 07:37 PM

Wow, that was fast. I was trying to figure out how to code it myself but i'm still learning this programming.

#34 darkrising

  • Members
  • 234 posts
  • LocationScotland

Posted 03 July 2013 - 03:34 AM

View Postencrypted, on 02 July 2013 - 07:37 PM, said:

Wow, that was fast. I was trying to figure out how to code it myself but i'm still learning this programming.

Yeah, I made this program to be extendible, its quite easy to add more commands, just make a new table in the comD table with a run function and help variable.

You can pretty much add whatever you want :)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users