Jump to content


sjele's Content

There have been 307 items by sjele (Search limited from 10-February 22)


By content type

See this member's


Sort by                Order  

#116770 Orange Anti-Virus beta 11.4 is Out!

Posted by sjele on 10 May 2013 - 04:33 AM in Programs

Where is the actual scanning part of "Scan files"? All i can see is deleting of files, and not actual scanning.



#116749 Computer Craft Coding Tutorial

Posted by sjele on 10 May 2013 - 02:44 AM in Tutorials

In your calculator tutorial, you would be better of by teaching the use of if-elseif-else, and not if-if-if-if. Meaning it would then be like this:

--[[...]]--
local result
if op == "add" then
  result = num1+num2
elseif op == "subtract" then
  result = num1-num2
elseif op == "multiply" then
  result = num1*num2
elseif op == "divide" then
  result = num1/num2
else
  result = "Unknown math mode, you can use: add, subtract, multiply and divide"
end

print("The answer is: "..result)

Also i shrunk it down to one print statement, much cleaner this way. (IMO)

Everyone should use local vars whereever they can, teaching them how to use those is much better then only using globals.
here is some info about local vars:
http://www.lua.org/pil/4.2.html
http://www.computerc...__fromsearch__1
Allso if i remmber right, bubba recently answerd a post about local/global, it was good, can't find it now :(/>

You could allso use the ternary operator to do this, but thats not really practical in this case, but it still does the job:
print("\nThe answer is "..(op == "add" and num1+num2 or (op=="div"and num1/num2 or (op == "mul" and num1*num2 or (op=="sub" and num1-num2 or "Unknown mode!")))))
Calculator using ternary:
Spoiler



#116603 Koding Discussion - Invites, Groups, etc.

Posted by sjele on 09 May 2013 - 01:27 PM in General

If I could get one I would greatly appreciate it.


Thanks PixelToast :)



#116354 CodeWars Reloaded - Round 2

Posted by sjele on 08 May 2013 - 01:03 PM in General

View Postoeed, on 08 May 2013 - 02:49 AM, said:

What do you guys think about a points bases system, rather than a knock out? It means you can do every challenge, and with the scoring system Lyqyd has developed it will be easy do do.

Much better, this way you still get to compete if you had little time this week (like me).



#110151 AX-OS The OS Of Tomorrow.

Posted by sjele on 15 April 2013 - 01:16 AM in Operating Systems

shell.run() should not be used as a way to loop something multiple times. Doing so will eventually cause a stackoverflow.
This problem exsists in settings.

How to recreate this:
Spam click on one of the 3 selection you can change around 256/257 times

How to loop something properly, without stackoverflows:
http://www.computerc...h-your-program/
http://www.computerc...pic/7999-loops/



#110108 AX-OS The OS Of Tomorrow.

Posted by sjele on 14 April 2013 - 10:45 PM in Operating Systems

Yeah, only one little thing that bugging me.
When logging in: While inputing text to one of the feilds I have to click enter to be able to select the other. Not a biggie but a bit annyoying.



#110102 AX-OS The OS Of Tomorrow.

Posted by sjele on 14 April 2013 - 10:24 PM in Operating Systems

This os looked nice untill I had completed registred and logged in, the main screen looks so ugly compared to login, register and settings. You guys should really work on the main screen.



#105391 turtle compitition

Posted by sjele on 03 April 2013 - 02:41 AM in General

So the turtle has to do everything, from smelting to buidling and mining? so you can do nothing but program?



#104417 Turning on a turtle without touching it

Posted by sjele on 01 April 2013 - 09:21 AM in Ask a Pro

View PostNinjawolf0007, on 01 April 2013 - 09:15 AM, said:

View Postsjele, on 01 April 2013 - 07:53 AM, said:

You could do it that way I belive.
Which way

Startup method with disk drive



#104381 Turning on a turtle without touching it

Posted by sjele on 01 April 2013 - 07:53 AM in Ask a Pro

You could do it that way I belive.



#104371 Turning on a turtle without touching it

Posted by sjele on 01 April 2013 - 07:37 AM in Ask a Pro

You need to make the side back a string like this:
peripheral.call("back", "turnOn")



#104368 using the keyboard in computercraft

Posted by sjele on 01 April 2013 - 07:29 AM in Tutorials

"If you press the up arrow key, it will send the id 200 to your computer. your computer takes the 208, and says "hey, 208 is the down arrow key!" and act accordingly."

I belive you have a type in there. You start off with key id 200, but end with 208 :P



#104308 [help] Print Error

Posted by sjele on 01 April 2013 - 05:24 AM in Ask a Pro

You forgot your () after clear on line 31, allso i changed clear to term.clear()

local up = 0
function mineup()
repeat
turtle.digUp()
turtle.up()
until turtle.detectUp() == false
repeat
turtle.down()
until turtle.detectDown() == true
end
function ddf()
if turtle.detect() == true then
turtle.dig()
turtle.forward()
else
turtle.forward()
end
end
function checkfuel()
if turtle.getFuelLevel <= 10 then
turtle.select(1)
turtle.refuel()
end
end
print("Hello. Welcome to the Cheesety210 Tree cutting program")
print("Please put your fuel in the first slot.")
turtle.turnRight()
turtle.turnRight()
turtle.turnRight()
turtle.turnRight()
term.clear() --In this line you made the error
print("I should be placed at the bottom of a tree next to it")
print("right next to the tree. A diagram is below.")
print(" [ ] = A log, and T is the turtle")
print("[ ] [ ] ")
print("[ ] [ ] ")
print(" T		 ")
print(" What is the width/length of the tree? In the example above it's 2.")
local length = read()
if length == 1 then
checkfuel()
ddf()
mineup()
end
if length == 2 then
checkfuel()
ddf()
mineup()
checkfuel()
ddf()
mineup()
checkfuel()
turtle.turnRight()
ddf()
mineup()
checkfuel()
turtle.turnRight()
ddf()
mineup()
checkfuel()
turtle.forward()
end
if length == 3 then
ddf()
mineup()
checkfuel()
ddf()
mineup()
checkfuel()
ddf()
mineup()
checkfuel()
turtle.turnRight()
ddf()
mineup()
checkfuel()
turtle.turnRight()
ddf()
mineup()
checkfuel()
ddf()
mineup()
checkfuel()
turtle.turnLeft()
ddf()
mineup()
checkfuel()
turtle.turnLeft()
ddf()
mineup()
checkfuel()
ddf()
mineup()
end
print("I am done with this tree!")



#104296 functions with until?

Posted by sjele on 01 April 2013 - 05:11 AM in Ask a Pro

You forgot () after all your turtle.(something) calls.

function mineup()
  repeat
	turtle.digUp()
	turtle.up()
  until turtle.detectUp() == false
  repeat
	 turtle.down()
  until turtle.detectDown() == true
end

This should work

[edit]Ninja'ed[/edit]



#104285 functions with until?

Posted by sjele on 01 April 2013 - 05:00 AM in Ask a Pro

The syntax for a repeat loop is this:

repeat
    --Your code that will be repeated
until (condition that makes it stop)

An exsample of this:
local x = 1
repeat
    x = x + 1
    print(x)
until x == 10



#103244 [Error][Lua] = Expected but not really..

Posted by sjele on 29 March 2013 - 08:29 AM in Ask a Pro

I am not sure if I understand whats wrong 100% but, it will never ever go to a slot higher than 2. Each time you call the function you reset Curslot to 1. So when slot 1 is empty it selects slot two, then when you place again it selects slot 2 again. And thus slot two may be empty and it will not place anything.



#94792 Guys,I think Lyqyd locked my post for absolutely no reason!SEE IF IT MAKES SENSE

Posted by sjele on 09 March 2013 - 06:02 AM in Forum Discussion

Programs section is for released programs. by that you need to have to release something, announcing belong in general.
http://www.computerc...rum-guidelines/



#94346 CC Syntax Highlighting/Code Completions v1.2 - Sublime Text 2

Posted by sjele on 08 March 2013 - 03:55 AM in APIs and Utilities

Allways used np++, then said to my selfs when i saw this: Gotta try sub lime text 2 out, loved from the first moment. Thanks :)



#89317 Program debugger

Posted by sjele on 21 February 2013 - 12:07 AM in Programs

View PostTheOriginalBIT, on 20 February 2013 - 11:20 PM, said:

More of a 'Program bugger' then :P

Yuup :)

As to the program, the log should probebly not be in the same file as the original program.
You should make a new file for it, maybe name it programname.log or something.
Not in the program you debug.



#89300 Program debugger

Posted by sjele on 20 February 2013 - 10:33 PM in Programs

So when i ran this program, i had to read to code to figure out how view worked, as i thought it was frozen or something. You should have told us how to make the darn screen in view update. I sat and looked at it for 1 minute, then got tired and pulled code open and noticed you needed a key event to go to next screen. Allso you could have told us what you saved log under, and you fucking rewrote my code. I ran the program with progname run Sjele to get a log. Then spent ages trying to find out how to read log, and now i tried to edit sjele again, and guess what now it looks like this: http://pastebin.com/tn0hUT3i

I guess this debugger breaks programs, i were lucky i used a test program not a fully functional one.

[edit]
You could told us that the clear thingy removes all the shit from the program
[/edit]



#88925 READ THIS

Posted by sjele on 20 February 2013 - 07:18 AM in Forum Games

When you post here, count dosent go one up.

[Edit]

Ninja'd

[/Edit]



#88298 getting more than one number

Posted by sjele on 19 February 2013 - 04:42 AM in Ask a Pro

Like this?

if x >= 1 and x <= 12 then
  print(x.." is between 1 and 12")
end



#80559 run functions of other files

Posted by sjele on 26 January 2013 - 08:56 AM in Ask a Pro

Wooooop, woop. Will edit :)



#80555 run functions of other files

Posted by sjele on 26 January 2013 - 08:48 AM in Ask a Pro

os.loadAPI("myApiFile")
myApiFile.functionName()



#78158 break doesn't like me?

Posted by sjele on 21 January 2013 - 09:22 AM in Ask a Pro

"For syntax reasons break can only appear at end of a block"

http://www.lua.org/pil/4.4.html