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

Wireless control

Started by Sindre2905, 10 February 2015 - 10:07 PM
Sindre2905 #1
Posted 10 February 2015 - 11:07 PM
I am a complete noob to this and i have miraculously managed to string toghether a program, but now i am wondering, is there any way to start a program on a computer from a pocket computer? like i type into the pocket computer "Run program ("base")" and it runs on my computer? if so how? all help is appreciated!
HPWebcamAble #2
Posted 11 February 2015 - 01:05 AM
You probably need to use modems for this.

The pocket computer could send a message through the modems, and the other computer would run the program when it got the message.

The receiving computer needs to be running a program that listens for messages.

Here is the Modem API: http://computercraft.info/wiki/Modem_%28API%29

Or the Rednet API: http://computercraft.info/wiki/Rednet_%28API%29

You can use either, but I personally prefer interfacing with modems directly (with the Modem API)

Just ask if you have any questions :)/>
Sindre2905 #3
Posted 11 February 2015 - 01:41 AM
Thanks a lot, i am now trying to figure out how to use the rednetAPI but whenever i try to use it i get an attempt to call nil. How do i actually use the API's? do i have to get them off pastebin and use the os.loadAPI? if so where can i find the pastebin? (i might be way off on that last part)
Dog #4
Posted 11 February 2015 - 01:55 AM
Don't forget read for typing in your commands (in case you weren't already aware)

EDIT: corrected a mistake
Edited on 17 February 2015 - 04:41 AM
Sindre2905 #5
Posted 11 February 2015 - 01:56 AM
Good job Dog, answered my question before it was approved!

Oh wait no you didnt, still, thanks Dog!
Dog #6
Posted 11 February 2015 - 02:59 AM
You're welcome :)/>

Please post your code - that'll help us help you a lot easier and faster.

In answer to using the APIs - no, you don't need to download them and use os.loadAPI - they're 'built-in' to CC's Lua

EDIT: Don't forget to use code tags for your code

[.CODE]
code here
[./CODE]

(use the above tags, but without the dots)
Edited on 11 February 2015 - 02:00 AM
HPWebcamAble #7
Posted 11 February 2015 - 03:50 AM
Thanks a lot, i am now trying to figure out how to use the rednetAPI but whenever i try to use it i get an attempt to call nil. How do i actually use the API's? do i have to get them off pastebin and use the os.loadAPI? if so where can i find the pastebin? (i might be way off on that last part)

Like Dog said all CC APIs are built in.

For example, with rednet:

rednet.open("right")
would open the modem on the right

You can always type 'help rednet' (replacing rednet with your API or program) in a CC terminal.
That might help give you some info In-game (and lets you know if your spelling is correct)