Jump to content




Program Silently Failing


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

#1 Brekkjern

  • Members
  • 13 posts

Posted 16 November 2013 - 10:13 PM

I'm having real difficulties making this program run properly. Whenever I run it, it just silently fails. It outputs "batbox_6" on the monitor, but then the program stops without doing anything else. There is no error message at all.

Pastebin link: http://pastebin.com/jW98THPm

I just want to note that I am in no way a good coder. I have been following a few guides to make this work, but I do understand most of it.

#2 Bomb Bloke

    Hobbyist Coder

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

Posted 16 November 2013 - 11:21 PM

Does it return to the command prompt, or just stall?

Directly after writing the batbox's name, it should process line 61:

mon.write("\n\tEU: "..self.getStored().." / "..self.getCapacity()..". "..self.getPercent().."\%\n")

Not 100% sure, but I don't believe you can use escape characters with mon.write(). At least, I gather they don't work with term.write(), which should be much the same thing.

self.getStored() doesn't return anything, so what I'd expect to happen is an "attempt to concatenate nil and string" error. Not sure why you're not seeing an error appear; I suppose fix that and see what the result is?

#3 Brekkjern

  • Members
  • 13 posts

Posted 16 November 2013 - 11:36 PM

Quote

Does it return to the command prompt, or just stall?
It just returned to the command prompt, but what you suggested below actually fixed it.

Quote

self.getStored() doesn't return anything, so what I'd expect to happen is an "attempt to concatenate nil and string" error. Not sure why you're not seeing an error appear; I suppose fix that and see what the result is?
Such a frustrating mistake to make :(
I made it into a variable to do some checks on it to see why it didn't work and forgot to make it return again...

As for the mon.write() not working with escape characters, you are right. I guess I have to find a way around it.

Edited by Brekkjern, 16 November 2013 - 11:42 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users