Jump to content


jay5476's Content

There have been 301 items by jay5476 (Search limited from 10-February 22)


By content type

See this member's


Sort by                Order  

#169297 Issues with turtle.getItemCount/Space

Posted by jay5476 on 23 March 2014 - 01:23 AM in Ask a Pro

-snip-



#157697 Trying to hack my way through.. ;)

Posted by jay5476 on 22 December 2013 - 07:18 PM in Ask a Pro

call the function
local power = batbox.getStored()
edit: You may also want to add that into your while loop so the variable keeps updating with the current powerr



#157234 Unable to end a program

Posted by jay5476 on 19 December 2013 - 02:56 AM in Ask a Pro

View PostDeath, on 18 December 2013 - 11:43 PM, said:

Here's a nice fix to your code
local pullEvent = os.pullEventRaw
Nope, can still be Ctrl+T'ed :P. Just a silly mistake is all replace
pullEvent = os.pullventRaw
with
os.pullEvent = os.pullEventRaw

Heat must be getting to everyone

View Posttheoriginalbit, on 19 December 2013 - 02:18 AM, said:

View Postjay5476, on 19 December 2013 - 01:08 AM, said:

Cuz this works in lua :P, looks like you were having a bad day...
whoops. yeh, the heat is getting to me, its sending me crazy *eye twitches*, its currently 44ºC (111ºF) inside my house...

Edit: Air conditioner is at other end of the house :/



#157230 Problem accessing global variables from an API

Posted by jay5476 on 19 December 2013 - 01:08 AM in Ask a Pro

View Posttheoriginalbit, on 18 December 2013 - 09:54 PM, said:

local function getName()
  return name + " bar"
end

Cuz this works in lua :P, looks like you were having a bad day...



#156790 Best Free Screen Capture Software For PC

Posted by jay5476 on 16 December 2013 - 07:47 AM in General

What do you think?



#156777 Check arguments passed?

Posted by jay5476 on 16 December 2013 - 05:53 AM in Ask a Pro

they way lua works you can do
if not value then
 stuff
end
or even this
value = value or DEFAULT_VALUE



#154959 [CC]Code Cleanup

Posted by jay5476 on 03 December 2013 - 05:06 AM in Forum Games

you assign the return value to a lower case 'x' and then later try to use an uppercase 'X'
if " 2+2" == "4" then
  print("4")
end
yes its real simple :/



#154950 Lua: What would you change?

Posted by jay5476 on 03 December 2013 - 02:33 AM in General

I know it should be made out of cheese but I want it to please even the people who are lactouse intolerant



#154944 Lua: What would you change?

Posted by jay5476 on 03 December 2013 - 12:22 AM in General

i find that the moon is pretty good atm and i would not change it



#154772 Make a Program with arguements

Posted by jay5476 on 01 December 2013 - 03:42 PM in Ask a Pro

Im pretty sure you got it but ill give an example
--sav file as print
local arg = {...}
for k, v in pairs(arg) do
print(v)
end
-- run it like: print this will print
now that will store your program args in a table an then print them out



#154708 ComputerCraft Standards

Posted by jay5476 on 01 December 2013 - 03:39 AM in General

Well if there was a standard for everything wouldn't it just be perfect... but there isn't, take minecraft for an example forge is having trouble porting to minecraft 1.7 because mojang changed a lot of its coding and then forge has to be familiarised with it same as al minecraft modders. people cant just stick to one thing... you tell someone to do it there not exactly going to do it, so what about all the people that coed before coming on this forum how are they supposed to know



#154702 [1.57] disk.isPlaying(string side) or os.pullEvent( "disk_stopedPlaying" )

Posted by jay5476 on 01 December 2013 - 01:38 AM in Suggestions

Well maybe do a music event
Return music,side,name,(start or end)

That way people can just time disks by events



#154700 ComputerCraft Standards

Posted by jay5476 on 01 December 2013 - 01:21 AM in General

No one will stick to a set of standards( people dont stick to the standard of indendation) the way that works for you is the way you use.



#154693 Pastebin

Posted by jay5476 on 30 November 2013 - 11:53 PM in Ask a Pro

Well when you goto pastebin and click on a paste it has its pastecode same when you upload one
You can use it like : pastebin get pastecode filetosaveto



#154648 redstone input checker

Posted by jay5476 on 30 November 2013 - 05:15 PM in Ask a Pro

while true do
  os.pullEvent("redstone")
  if rs.getInput("right") and rs.getInput("left") then
     -- do stuff
  end
end
if it gets signal from both sides it will run the code before the second last end



#154563 Fs (API), what is that?

Posted by jay5476 on 30 November 2013 - 01:41 AM in Ask a Pro

I know your a bit confused but, files arnt just for program's. See above posts but files can be a useful way to save information that you can then read or edit from th fs api



#154562 Vms?

Posted by jay5476 on 30 November 2013 - 01:13 AM in Ask a Pro

DO NOT DISABLE _G
Read this: http://www.lua.org/pil/14.3.html
I suggest you learn enviroments better ( I dont claim to know them that well either ) but what i would suggest is an enviroment that simply does not have averse to _G but without basic functions that nearly every program depends on (eg. print) the computer will shut down with no warning or error message
( since it cannot print )
Maybe a soloution is this
f = fs.open(filename,"r")
content = f.readAll()
f.close()
env = {print = _G.print} -- etc.
program,err = loadstring(content)
if program then 
  setfenv(program,env)
program()
else
  print(err)
  error()
end
PM me if you need help with this, ill be glad to hel you out



#154560 Fs (API), what is that?

Posted by jay5476 on 30 November 2013 - 12:55 AM in Ask a Pro

Well most commonly people use it with their turtle program's to keep track of where it is in case of a shutdown and having to start from the start( cant give some code here )
But an example i can give is a password lock
repeat
if fs.exists("password") then
  fileHandle = fs.open("password","r") -- open file in read mode
  local pass = fileHandle.readAll() -- read everything in the file
  fileHandle.close() -- make sure to close
else
  write("Enter new password: ")
  local pass = read("*")
  fileHandle = fs.open("password","w") -- open file in write mode
  fileHandle.write(pass) -- store password in the file
  fileHandle.close() -- again close the file
end
term.clear()
term.setCursorPos(1,1)
write("Enter Your Password: ")
input = read("*") 
until input == pass

Edit: Basically if a password file doesn't exist yet then it will create the file and write the password to it otherwise it will read from the password file and then store it in the variable called pass and then compare later on



#154529 Pastebin account

Posted by jay5476 on 29 November 2013 - 09:15 PM in Ask a Pro

I Believe you could use Dropbox and download from it, the advantage being Dropbox updates your files for you always keeps latest version



#154526 Enchantable Turtles

Posted by jay5476 on 29 November 2013 - 09:04 PM in Suggestions

Idk about this... efficient on a turtle which breaks blocks instantly hows that work?



#154524 Function Help.

Posted by jay5476 on 29 November 2013 - 08:56 PM in Ask a Pro

add(2,2,"Games")
Need quotation marks to tell it its a strig



#154434 How do you program

Posted by jay5476 on 28 November 2013 - 11:15 PM in Ask a Pro

View PostMadBudderKing, on 28 November 2013 - 06:13 PM, said:

Hi, im new. I want to know how to program. I know that computercraft uses lua, but are some basics of lua that I need to know?

Thanks
Well of course you need to learn the basics, check out the tutorials on the forums use google and or YouTube for tutorials on how to do everything, and your also welcome to ask any question that sticks by the guidelines here and people will be happy to help you out if your stuck



#154410 Train stop program.

Posted by jay5476 on 28 November 2013 - 05:24 PM in Ask a Pro

Yeh your problem is that it doesn't yield. A computer doesn't yield then other conputers cant run, the computer shuts don to allow for others to run.



#154317 Vms?

Posted by jay5476 on 27 November 2013 - 11:30 PM in Ask a Pro

1. Disabling _G is possible but will turn the computer off immediatly
2. People cat just change an enviroment like
env ={}



#154275 Vms?

Posted by jay5476 on 27 November 2013 - 03:41 PM in Ask a Pro

Wow that's a good idea if someone was to implement it since the server would practically run everything and nothing reaqlly harmful could be done to the client