M-C Posted February 13, 2013 Posted February 13, 2013 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: 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. Quote
disconsented Posted February 13, 2013 Posted February 13, 2013 forgot the brackets at the line above Quote
M-C Posted February 13, 2013 Author Posted February 13, 2013 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 Quote
Korialstrasz Posted February 13, 2013 Posted February 13, 2013 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 Quote
M-C Posted February 13, 2013 Author Posted February 13, 2013 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: Quote
Korialstrasz Posted February 13, 2013 Posted February 13, 2013 mh maybe im wrong but i found this: http://computercraft.info/wiki/OpenCCSensors And it looks like that your name and basicDetails are invalid names for the information. In the exaple they use k and v. Quote
Casstor Posted February 13, 2013 Posted February 13, 2013 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(...) ?? Quote
M-C Posted February 13, 2013 Author Posted February 13, 2013 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 EDIT 2: Seems like it can only display one target at a time... Anyone got an idea for multiple targets? Quote
Casstor Posted February 14, 2013 Posted February 14, 2013 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 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.