Jump to content




write function problem


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

#1 BlueZero

  • Members
  • 41 posts

Posted 13 June 2013 - 05:46 AM

I'm making a little bit of an ASCII GUI for my program. I managed to get the location of everything fixed properly so it'll display nicely but for some reason it doesn't want to work that way.

Here's my code:

function gateKeeper()
  shell.run("clear")
  term.setCursorPos(15,7)
  write("Bluelock 2.0 running ")
  term.setCursorPos(15,8)
  write("on computer: ", os.getComputerID()) -- won't display computer ID
  term.setCursorPos(15,9)
  write("OS Version: ", os.version()) -- won't display os version
  term.setCursorPos(15,10)
  write("To view credits")
  term.setCursorPos(15,11)
  write("type \"credits\".")
  term.setCursorPos(15,13)
  write("Password: ")
  input = io.read()
  shell.run("clear")
end

I'm not sure what I'm doing wrong. It'd normally display something but I'm getting a blank spot for where the computer ID and the OS Version would be. I'm wondering if I got something wrong here?

#2 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 13 June 2013 - 05:53 AM

The problem is because the write function, unlike the print function, does not allow for multiple arguments. So change the comma's to the concat operator (..)
So instead of
write("on computer: ", os.getComputerID())
it should be
write("on computer: "..os.getComputerID())


#3 BlueZero

  • Members
  • 41 posts

Posted 13 June 2013 - 05:55 AM

View Posttheoriginalbit, on 13 June 2013 - 05:53 AM, said:

The problem is because the write function, unlike the print function, does not allow for multiple arguments. So change the comma's to the concat operator (..)
So instead of
write("on computer: ", os.getComputerID())
it should be
write("on computer: "..os.getComputerID())

AW! I didn't know this! Lol, now I'm lookin' silly. Thanks man. Forgot all about the concat operator.

#4 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 13 June 2013 - 05:59 AM

haha thats ok, we all have our momentary lapses of judgement. No one is perfect, thats why we need bug trackers and beta tests, etc.





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users