Jump to content




simple program help


  • You cannot reply to this topic
34 replies to this topic

#21 HugoCoin

  • Members
  • 18 posts

Posted 15 July 2014 - 05:17 PM

whats the difference?
and does it matter for what i am making?
the words that are green in te code, the explaining. does that need to be removed?

Edited by HugoCoin, 15 July 2014 - 05:19 PM.


#22 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 15 July 2014 - 05:22 PM

View PostHugoCoin, on 15 July 2014 - 05:17 PM, said:

whats the difference?
and does it matter for what i am making?

The main difference is mine uses the parallel api. There is virtually no difference for what you are making, but mine is much, much longer if you include the amount of code in the parallel api... which you should not look at until you think you are a master of everything else and have read the coroutine tutorial.

#23 hilburn

  • Members
  • 153 posts
  • LocationLondon, England

Posted 15 July 2014 - 05:26 PM

View PostHugoCoin, on 15 July 2014 - 05:17 PM, said:

whats the difference?
and does it matter for what i am making?
the words that are green in te code, the explaining. does that need to be removed?

Yami answered the first two well, and as for the 3rd, no, anything that follows "--" will be ignored when you run the program

#24 HugoCoin

  • Members
  • 18 posts

Posted 16 July 2014 - 10:12 AM

thanks, that was what i needed.
but one more question, how do you enter on a monitor?
i have the door open and cloned directly behind each other, and sometimes the text is in the middle, sometimes completely in the left and sometimes half of the screen.

#25 hilburn

  • Members
  • 153 posts
  • LocationLondon, England

Posted 16 July 2014 - 10:20 AM

monitor.clear() --#clears the monitor, do this between changing the text
monitor.setPos(x,y) --#positions the cursor, do this before writing new text (1,1) is top left corner, (1,2) is beginning of second line etc
monitor.write(text) --#write stuff

Edited by hilburn, 16 July 2014 - 10:21 AM.


#26 HugoCoin

  • Members
  • 18 posts

Posted 16 July 2014 - 11:28 AM

thank you guys :)
do i need to close it now?

Edited by HugoCoin, 16 July 2014 - 11:29 AM.


#27 flaghacker

  • Members
  • 655 posts

Posted 16 July 2014 - 11:47 AM

You can't close a topic, only a moderator can do that. To ask a moderator to close a topic, report the thread. But don't do that, topics aren't closed when the question is answered, because you or someone else might have further questions or someone might have a better answer. Topics are only closed when someone answers on a old and dead topic, that's called a "necro".

#28 HugoCoin

  • Members
  • 18 posts

Posted 16 July 2014 - 12:07 PM

okey

#29 HugoCoin

  • Members
  • 18 posts

Posted 08 January 2015 - 09:06 PM

so, i just wanted to try something.
and i wrote this to see if i could do that. And i failed :(
it's supposed to check for rs left, turn on a light on the top, just for checking if it works, and then write test test on a monitor.
There are no errors, but it just does nothing.
http://pastebin.com/dtB39WD8

Edited by HugoCoin, 08 January 2015 - 09:07 PM.


#30 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 08 January 2015 - 09:12 PM

Lua is case-sensitive. The event name is "redstone", not "Redstone", and the term call is setCursorPos.

#31 HugoCoin

  • Members
  • 18 posts

Posted 13 January 2015 - 05:01 PM

Thank you.
I managed to make something, but i cant solve this again.
the problem now is that i want the error and the "file too big" on the screen at the same time.(error first and then file too big joining it). it now deletes the error while it writes the file too big.
also i tried to make a flashing dot if there is no redstone singnal, or if it is active. (started up with redstone)
but that doesn't do anything.
http://pastebin.com/dGHsfqEX

sorry for my english if it is bad

Edited by HugoCoin, 13 January 2015 - 05:03 PM.


#32 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 13 January 2015 - 11:20 PM

redstone.getInput() only pays attention to the first parameter you pass to it - it returns true if that side has a redstone signal, or false if it does not. redstone.getInput("back",true) acts exactly the same as rs.getInput("back", false), and exactly the same as rs.getInput("back").

Changing the text scale on a monitor changes all text that was already on that monitor too. The only way to have multiple lines displayed with different scales at the same time is to use more than one monitor.

Your dot doesn't blink because after you clear it off the screen, you don't draw it again until another redstone event is pulled.

You could shrink your script down a fair bit if you made a function that let you condense your monitor-writing operations. A basic re-write might look like this:

Spoiler

Edited by Bomb Bloke, 13 January 2015 - 11:44 PM.


#33 HugoCoin

  • Members
  • 18 posts

Posted 15 January 2015 - 07:06 PM

what does the "local" do?

#34 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 15 January 2015 - 07:24 PM

local simply defines a variable as, well, local. Rather than being global.

local variables are accessed faster than global variables, and cannot be changed by other scripts. Global variables are slower and can be changed by other scripts.

--#good practice
local var = read()
--#bad practice
var = read()


#35 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 15 January 2015 - 11:06 PM

See here for more details.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users