Jump to content

Recommended Posts

Posted

So, I was trying to make a radar with a monitor and ccSensors, I'm not very skilled with computercraft but I know a bit about it. Now, I've stumbled upon a problem. I get an error saying an '=' is expected at line 7, which is the line saying 'mon.setTextScale(5). I don't know why it expects an = here, could anyone possibly help? Here's my code:

oIE06YM.png

This all runs through a startup program which basically keeps it on when redstone is applied:

while redstone.getInput("left") == true do shell.run("getcard")

end

getcard being the program in the picture.

Posted

forgot the brackets at the line above

oh wow, that's a stupid mistake, thanks a lot! Changed it, monitor's still not displaying anything... No errors though

EDIT: the screen is 5 horizontally and 3 vertically.

EDIT 2: changed the cursor positions to 1,1 1,2 and 1,3. Still nothing displayed

Posted

well from my basic programming skills in lua i deduct that you are running an infite loop with your programm.

it gets call every milli clears the monitor prints something and cleares the monitor prints something etc.

so it not to that your monitors doenst show anything. you are just to slow to see it.

Also:

for ...

mon.clear()

mon.setScale()

mon.setCursorPos()

.

.

.

end


 

what you probably wanna do is

 


mon.clear()

mon.setScale()

mon.setCursorPos()

for ...

.

.

.

end

EDit: Missed the sleep at the end, but still the argument on sleep is the time in milliseconds

Posted

well from my basic programming skills in lua i deduct that you are running an infite loop with your programm.

it gets call every milli clears the monitor prints something and cleares the monitor prints something etc.

so it not to that your monitors doenst show anything. you are just to slow to see it.

Also:

for ...

mon.clear()

mon.setScale()

mon.setCursorPos()

.

.

.

end


 

what you probably wanna do is

 


mon.clear()

mon.setScale()

mon.setCursorPos()

for ...

.

.

.

end

I've tried doing that, still nothing getting displayed. About the first thing, it sleeps for one second before it clears the screen (second last line). So it shouldn't go away too quickly.

EDIT: aha, it says error: attempt to call nil at line 9.

Here's what my code currently looks like:

CGvRv72.png

Posted

Its a variable, he can call it pretty much what he want.

Have you tryed what #4 sugested, and changed the .print(...)'s to .write(...) ??

Hm, no, brb, I'll try

EDIT: It worked! Great! I've got a working radar :D

EDIT 2: Seems like it can only display one target at a time... Anyone got an idea for multiple targets?

Posted

You keep overwriting your previous target, so it will allways show only the last target.

Change your code to something like

mon.clear()

mon.setScale()

x = 0

for ...

mon.setCursorPos(1,x+1)

-print name-

mon.setCursorPos(1,x+2)

-print HP-

mon.setCursorPos(1,x+3)

-print line-

x = x+3

end

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...