- ComputerCraft | Programmable Computers for Minecraft
- → fishermedders's Content
fishermedders's Content
There have been 9 items by fishermedders (Search limited from 10-February 22)
#265395 [2019] [1.12.2] [Survival] LurCraft : We're back, and better than ever!
Posted by
fishermedders
on 06 March 2017 - 08:59 PM
in
Servers
IGN: XMedders
Programming Knowledge: 7/10
#265171 Wireless Control
Posted by
fishermedders
on 28 February 2017 - 02:12 AM
in
Turtle Programs
Otherwise, the Turtle Client looks good - Just for future reference, it's nice to make your code look nice by indenting.
e.g
if command == 'up' then turtle.up() end
I would also recommend the use of 'elseif', because there can only be one case per received rednet message, so you really don't need to check for all of them.
e.g
if command == 'up' then turtle.up() elseif command == 'down' then turtle.down() elseif command == 'forward' then turtle.forward() elseif command == 'back' then turtle.back() elseif command == 'left' then turtle.turnLeft() elseif command == 'right' then turtle.turnRight() elseif command == 'fuel' then turtle.select(16) turtle.refuel() end
Another thing that would make/break this program (if it had the controller) is the ability to dig & place (with up varieties), and select (maybe clicking the button and then entering the slot number).
Also, where you have
id, command = rednet.receive()I would recommend checking to see if the commands are coming from your pocket computer, like so.
--Run program 'id' on Pocket Computer to get id number.
id, command = rednet.receive()
if id == 1337 then -- This checks the received id to make sure you can only send commands.
if command == "up" then
turtle.up()
elseif command == "other commands" then
--etc
end
end
This is useful because if someone else is receiving messages, they can broadcast these same commands and then potentially control your turtle.Otherwise it looks good keep working on this homie
#265158 Please Delete.
Posted by
fishermedders
on 27 February 2017 - 01:23 PM
in
Servers
Programming: about 3 years
#265152 PLoad | A way to use pastebin in your code
Posted by
fishermedders
on 27 February 2017 - 04:22 AM
in
APIs and Utilities
CLNinja, on 27 February 2017 - 04:04 AM, said:
.......
THIS IS AN API YOU NITWIT, YOU JUST EXPLAINED HOW TO USE THIS API.
lmao chill hombre, I'm just saying that instead of downloading the file every time and loadstring'ing it every time, it'd just be easier to download it once and maybe even check for newer versions. The whole point of my posts is my suggestion of that of the pastebin blacklist
#265149 PLoad | A way to use pastebin in your code
Posted by
fishermedders
on 27 February 2017 - 02:24 AM
in
APIs and Utilities
CLNinja, on 26 February 2017 - 08:53 PM, said:
fishermedders, on 26 February 2017 - 07:16 PM, said:
CLNinja, on 26 February 2017 - 05:00 PM, said:
Just like if you're gonna have a bunch of functions to use in a program, why not create an API that you can use over and over again (or just for this 1 program), that has all of the functions that you need in it, and download it once rather than spamming pastebin for it. Just my opinion.
myapi:
function centerPrint( sText, nY ) -- The text to center, the Y Line.
tSize = { term.getSize() }
term.setCursorPos( math.floor( tSize[1]/2 )-math.floor( #sText/2 ), nY )
term.write( sText )
end
function sayHello()
print( "Hello, world!" )
end
function foo()
return "bar"
end
Then in another file, you would be able to do things like:
programusingapi:
bDidLoad= os.loadAPI("myapi")
if bDidLoad then
myapicenterPrint( "Hello World!", 1 )
myapi.sayHello()
print( myapi.foo() )
end
I usually make APIs like this for functions that I use most often.
[Edit Reason: Wacky code formatting]
#265146 Need your help...please
Posted by
fishermedders
on 27 February 2017 - 02:08 AM
in
Ask a Pro
Dave-ee Jones, on 26 February 2017 - 10:55 PM, said:
There is no function called :
textutils.slowWrite()So you'll have to use:
textutils.slowPrint()
I was suprised to see this too, but there actually is a function called textutils.slowWrite()
#265137 PLoad | A way to use pastebin in your code
Posted by
fishermedders
on 26 February 2017 - 07:16 PM
in
APIs and Utilities
CLNinja, on 26 February 2017 - 05:00 PM, said:
Just like if you're gonna have a bunch of functions to use in a program, why not create an API that you can use over and over again (or just for this 1 program), that has all of the functions that you need in it, and download it once rather than spamming pastebin for it. Just my opinion.
#265127 Krist - Minable currency that works across servers (paste updated)
Posted by
fishermedders
on 26 February 2017 - 02:20 PM
in
Programs
WE NEED MOAR DOMAINS
#265087 PLoad | A way to use pastebin in your code
Posted by
fishermedders
on 24 February 2017 - 11:36 PM
in
APIs and Utilities
Imo it would just be easier to make a general-use api to include your functions in.
- ComputerCraft | Programmable Computers for Minecraft
- → fishermedders's Content


