Jump to content




Warpdrive Mod Continual Ping Program

peripheral computer lua

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

#1 Bobby

  • Members
  • 3 posts

Posted 18 March 2018 - 04:43 AM

I'm pretty new to Lua programming, so I hope you all treat me gently!
This is a little program I wrote to ping continually with the radar from the Warpdrive mod.
It will ask for radius, and whether or not you want to use a monitor.
If you choose to use a monitor, it will ask which side it is on.
Once you start it, it will loop forever, or until you terminate it with Ctrl-T.
You can get it with
pastebin get QjwmFE3p
If anyone has suggestions or problems, please tell me!
Very important! Once you run it for the first time you can't edit anything else on that computer!!
I don't know why, but I'm trying to figure it out. In the meantime, only use this on
computers where you don't plan on editing anything.

Edited by Bobby, 18 March 2018 - 05:43 PM.


#2 Purple

  • Members
  • 115 posts
  • LocationAlone in the dark, looking at the pretty lights with dreams of things I can not have.

Posted 18 March 2018 - 08:53 AM

Have you tried editing it manually by opening the text file in your worlds save folder?

#3 Bobby

  • Members
  • 3 posts

Posted 18 March 2018 - 05:42 PM

Quote

Have you tried editing it manually by opening the text file in your worlds save folder?

Yes, that works and I also copied it to another CC computer to do it there where you can edit it just fine. I can't seem to crack what is causing it.
After I run it for the first time, I am prevented from editing this or any other program on that specific computer. I can still copy and delete them, so
I can just copy them to another computer and edit them there, deleting the original before I copy it back. I am, however, still trying to figure it out.

#4 Lupus590

  • Members
  • 2,028 posts
  • LocationUK

Posted 19 March 2018 - 09:37 AM

Are you using local variables? If not then the leftover globals may be the issue.

#5 SuperDyl19

  • Members
  • 15 posts

Posted 19 March 2018 - 03:30 PM

Here's a link for reference: https://pastebin.com/QjwmFE3P

Global variables are used, but their given new values so I doubt that's the issue. Still, it's good practice to make variables local to avoid issues and for all I know it could be an issue.

Good luck!

#6 Dog

  • Members
  • 1,179 posts
  • LocationEarth orbit

Posted 19 March 2018 - 03:52 PM

I didn't see any obvious indicators in the code you posted as to why this is happening; but that code also runs 'ping' which, as far as I know, isn't included with ComputerCraft. Can you please also post the code for your ping program as well?

#7 Bobby

  • Members
  • 3 posts

Posted 26 March 2018 - 09:33 PM

Sorry for taking so long to get back here.

Quote

global variables
I did try this, that just requires putting local before the variable right? Like
local m=io.read()

Quote

my ping program
It's not my program, it is packaged with the Radar in the WarpDrive mod. I did however upload it to pastebin so you could see it. https://pastebin.com/vnEqq9Z0





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users