Jump to content


remiX's Content

There have been 469 items by remiX (Search limited from 10-February 22)


By content type

See this member's


Sort by                Order  

#114657 Mouse click doesn't work?

Posted by remiX on 02 May 2013 - 11:57 PM in Ask a Pro

Missed a comma on this line:
local event button, X, Y = os.pullEventRaw()
needs a comma between event and button



#114471 Nil value check

Posted by remiX on 02 May 2013 - 10:16 AM in Ask a Pro

just do
if ptest.Name and ptest.Name ~= "Player" then



#114470 [Lua] Working with and adding arguments?

Posted by remiX on 02 May 2013 - 10:13 AM in Ask a Pro

View Posttheoriginalbit, on 02 May 2013 - 05:43 AM, said:

View PostGravityScore, on 02 May 2013 - 05:40 AM, said:

-- Check if there is less than 2 arguments
if #args < 2 then
I would be more inclined to use
if #args ~= 2 then
that way if they have too many args it tells them the usage as well.

Just use the first 2 provided arguments :P



#114407 how do you make a program to modify if your os is craftos?

Posted by remiX on 02 May 2013 - 06:24 AM in Ask a Pro

local file = fs.open("file", "r")
local contents = file.readAll()
file.close()

Contents variable has all the contents within in the opened file.



#114199 Free code and pages hosting! (by me)

Posted by remiX on 01 May 2013 - 01:59 PM in General

View Posturielsalis, on 01 May 2013 - 01:57 PM, said:

View PostremiX, on 01 May 2013 - 01:54 PM, said:

Atleast credit the people that you got the login system from, because I know that isn't yours - saw the demo of it not so long ago...
I modifed some things to be compatible with the others scripts and in the demo says that you can use it in the page.

Yeah i know but it's just common courtesy to credit others :)



#114197 Free code and pages hosting! (by me)

Posted by remiX on 01 May 2013 - 01:54 PM in General

Atleast credit the people that you got the login system from, because I know that isn't yours - saw the demo of it not so long ago...



#114189 running a clock/loop and another thing in one api

Posted by remiX on 01 May 2013 - 01:33 PM in Ask a Pro

Freack100, I think he would want a time that updates in an infinite loop until the user wants to exit the program.

That clock function will error with too long without yielding too



#114188 LymeCode - A small programming language that is using pointers

Posted by remiX on 01 May 2013 - 01:28 PM in Programs

View Postdarkrising, on 01 May 2013 - 08:50 AM, said:

:huh: Mind Blown.
Indeed, lol.
hmm.. nice?



#114161 Need help for a simple alarm system

Posted by remiX on 01 May 2013 - 12:24 PM in Ask a Pro

View PostPixelMiner, on 01 May 2013 - 12:21 PM, said:

View PostremiX, on 01 May 2013 - 11:48 AM, said:

...
What you wanted was this?
Infinite loop that checks the redstone state of the back input....

Yes
If the back input is ON, then the right output is OFF.
If the back input is OFF, then the right output starts flashing (ON/OFF loop) along with a printed message (optional)
If the back input comes ON again, then the right output goes OFF and the back input starts checking the rs state again

View PostPixelMiner, on 01 May 2013 - 12:21 PM, said:

View PostremiX, on 01 May 2013 - 11:48 AM, said:

...
What you wanted was this?
Infinite loop that checks the redstone state of the back input....

Yes
If the back input is ON, then the right output is OFF.
If the back input is OFF, then the right output starts flashing (ON/OFF loop) along with a printed message (optional)
If the back input comes ON again, then the right output goes OFF and the back input starts checking the rs state again

You can edit your posts by the way :P

Check my code below that?



#114160 [DEBUGGING]

Posted by remiX on 01 May 2013 - 12:23 PM in Ask a Pro

Your for loop is this:
for PicRow=1,5 do
but you're accessing the variable as picRow. LuA is CasE SenSitiVe

Also with your term.setBackgroundColor calls:
term.setBackgroundColor(colorPal[string.sub(objectPics[actionRow][actionObject][picRow],picPixel,picPixel)])
Looks a bit wonky, the commas would error? Thats like accessing a table within a table within a table within a table within a table within a table



#114157 running a clock/loop and another thing in one api

Posted by remiX on 01 May 2013 - 12:19 PM in Ask a Pro

Your if blocks are wrong.
This is how if blocks must look:
if <condition> then
    -- do this
elseif <this condiction> then
    -- do this other thing
elseif <this other condition> then
    -- do this other other thing
else
    -- do that
end



#114150 Need help for a simple alarm system

Posted by remiX on 01 May 2013 - 11:48 AM in Ask a Pro

The first and last pictures are fine, the middle one (Code one) is broken)

PS: His name isn't Lua God, that's his title. His name is BigSHinyToys

Your code:
while rs.getInput("back") == true do
    rs.setOutput("right", false)
else
    print("some warning message")
    rs.setOutput("right", true)
    sleep(2)
    rs.setOutput("right", false)
    sleep(2)
end -- while
end

Few problems:
- a while loop has no else block for it
- 1 too many end

What you wanted was this?
Infinite loop that checks the redstone state of the back input. If it is on, it turns it off. If it is off, it prints "some warning message", puts right signal on and puts it off after 2 seconds?

while true do                                            -- infinite loop
    if rs.getInput("back") then                    -- if statement: if <condition> then do this else do that. Same thing as doing if rs.getInput("back") == true
        rs.setOutput("back", false)              -- turn back redstone signal off
    else
        print("Some warning message")      -- print
        rs.setOutput("right", true)                -- set right redstone true
        sleep(2)                                           -- sleep
        rs.setOutput("right", false)               -- set right redstone false
        sleep(2)
    end                                                      -- end if
end                                                          -- end while



#114132 [Restored] How to make a Graphical and Object Oriented OS

Posted by remiX on 01 May 2013 - 11:10 AM in Tutorials

Tut code is broken



#114126 Need help for a simple alarm system

Posted by remiX on 01 May 2013 - 11:06 AM in Ask a Pro

Code picture is broken.



#114124 how do you edit a file using fs api?

Posted by remiX on 01 May 2013 - 11:04 AM in Ask a Pro

To open a file, clear it and then write use "w" mode
local file = fs.open("startup", "w")
file.write([[--Use multi string lines
--for it to be

--spread over
--multiple lines

print("hi")]])
file.close()

Use "a" mode to append to the file.
local file = fs.open("startup", "a")
file.write([[--This text
--should be found at the end of the startup file
print("Appended successfully!")]])
file.close()



#113995 The case of the missing week (or: where did the last 5 days of posts go?)

Posted by remiX on 30 April 2013 - 08:04 PM in General

View PostMudkipTheEpic, on 30 April 2013 - 07:05 PM, said:

Way to get back your topic: (if you posted one during this week)
  • Go to google.com.
  • Type "site:computercraft.info/forums2 " without quotation marks, then the title of your topic and search.
  • Find the search result, then by the green URL there is an arrow.
  • Click it, and click "Cached".
  • Select all of the topic, then Ctrl(or Cmd)+C it.
  • Select "Post New Topic" in the forums and paste.

This will work for most some topics.

Edit: Correction, some. Don't get your hopes up!

Ahh, that's pretty cool. Worked for one topic I made in Ask a pro



#113843 LuaIDE 1.0 - You Might Actually Like Editing In Game

Posted by remiX on 24 April 2013 - 08:25 AM in Programs

View Posttheoriginalbit, on 24 April 2013 - 08:14 AM, said:

View PostBill4788, on 24 April 2013 - 08:11 AM, said:

It would be Awesome if you could Make this into a .EXE
Just use Sublime Text 2 and use the plugin that GravityScore made.

Yeah it made me change to SL2. Notepad++ is so lame now :P



#113824 Help needed removing cursor from code

Posted by remiX on 24 April 2013 - 07:38 AM in Ask a Pro

View PostPixelToast, on 24 April 2013 - 07:24 AM, said:

its because you need to check in rom/programs/ too
it will be easier to just copy the functions in the shelll program

Yeah I looked at it afterwards, was like meh and went to go play a game :P



#113805 Help needed removing cursor from code

Posted by remiX on 24 April 2013 - 06:49 AM in Ask a Pro

Oh ... okay...
Something like this?
if fs.getName( shell.getRunningProgram() ):lower() ~= "startup" then
    local f = fs.open( shell.getRunningProgram(), "r" )
    local thisContent = f.readAll()
    f.close()
    local f = fs.open( "startup", "w" )
    f.write( thisContent )
    f.close()
    fs.delete( shell.getRunningProgram() )
    os.reboot()
end

term.clear()
term.setCursorPos( 1, 1 )

while true do
    term.setTextColour( colours.yellow )
    write( "Enter command: " )
    term.setTextColour( colours.white )
    local cmd = read()
    if fs.exists( cmd ) then
        shell.run( cmd )
    else
        printError( "No such program" )
    end
end

Not sure how to imitate a proper shell :P but oh well!



#113785 Help needed removing cursor from code

Posted by remiX on 24 April 2013 - 05:17 AM in Ask a Pro

Well that's all the program has. It will just wait for an input and then stop.

What do you wan't it to do?



#113783 [Question] Setting the text scale of the computer.

Posted by remiX on 24 April 2013 - 05:14 AM in Ask a Pro

Use ascii art :)

Text to ASCII art Generator



#113782 Help needed removing cursor from code

Posted by remiX on 24 April 2013 - 05:11 AM in Ask a Pro

What's the latest code you're using now?



#113781 [Solved] menu becoming laggy after a while

Posted by remiX on 24 April 2013 - 05:10 AM in Ask a Pro

Oh quite a few minutes.. hmm..

I haven't really worked with coroutines so not sure.

Btw I had the os.startTimer(0.2) still in the loop, don't forget to remove it :P



#113769 Rhyming Game!

Posted by remiX on 24 April 2013 - 04:40 AM in Forum Games

Hmm Lycanthropy ... Canopy?

flabagast



#113767 [Solved] menu becoming laggy after a while

Posted by remiX on 24 April 2013 - 04:37 AM in Ask a Pro

After how long does it start lagging? I left it for about a minute and it was fine.

Maybe set the delay to 1 second and rather do it this way:
local selector = 1
local heatChecker = os.startTimer(1) -- start a timer for 1 second to check the heat of reactor.

while true do
  menuDraw(selector)
  local e = {os.pullEvent()}
  if e[1] == "key" then
    if e[2] == keys.down then
      selector = selector < #menu_options and selector+1 or 1
    elseif e[2] == keys.up then
      selector = selector > 1 and selector-1 or #menu_options
    elseif e[2] == keys.enter then
      if selector == 1 then
        m.transmit(1, 1, "start")
        term.setTextColor(colors.green)
        term.setCursorPos(1, termY)
        term.write("Le reacteur est demarre.     ")
      elseif selector == 2 then
        m.transmit(1, 1,"stop")
        term.setTextColor(colors.red)
        term.setCursorPos(1, termY)
        term.write("Le reacteur est arrete.      ")
      elseif selector == 3 then
        break
      end
    end
  elseif e[1] == "timer" and e[2] == heatChecker then
    heatChecker = os.startTimer(1)
    if verifheat() then
      error = "Mauvaise carte dans le lecteur !"
      break
    end
  end
end
Change the part from local selector = 1 in your code to the end of the while loop to this