This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Xemiru's profile picture

Error : Multiple Points

Started by Xemiru, 15 February 2012 - 12:01 AM
Xemiru #1
Posted 15 February 2012 - 01:01 AM

--Installer API Functions
function clearS()
term.clear()
term.setCursorPos(1,1)
end
function mainmenu()

logo()
sleep(3)
term.setCursorPos(1,13)

c1 = true
c2 = false
c3 = false
c4 = false

print("			    Install ScarletOS")
print("				 Format Computer")
print("				 About ScarletOS")
print("					   Exit")

while true do
  event, param1 = os.pullEvent()
  if event == "key" and param1 == 28 and c1 == true then
   install()
  elseif event == "key" and param1 == 28 and c2 == true then
   cFormat()
  elseif event == "key" and param1 == 28 and c3 == true then
   about()
  elseif event == "key" and param1 == 28 and c4 == true then
   break
  end
 
  if event == "key" and param1 == 200 and c1 == true then
   c1 = false
   c2 = false
   c3 = false
   c4 = true
  elseif event == "key" and param1 == 200 and c2 == true then
   c1 = true
   c2 = false
   c3 = false
   c4 = false
  elseif event == "key" and param1 == 200 and c3 == true then
   c1 = false
   c2 = true
   c3 = false
   c4 = false
  elseif event == "key" and param1 == 200 and c4 == true then
   c1 = false
   c2 = false
   c3 = true
   c4 = false
  elseif event == "key" and param1 == 208 and c1 == true then
   c1 = false
   c2 = true
   c3 = false
   c4 = false
  elseif event == "key" and param1 == 208 and c2 == true then
   c1 = false
   c2 = false
   c3 = true
   c4 = false
  elseif event == "key" and param1 == 208 and c3 == true then
   c1 = false
   c2 = false
   c3 = false
   c4 = true
  elseif event == "key" and param1 == 208 and c4 == true then
   c1 = true
   c2 = false
   c3 = false
   c4 = false
  end
end

if c1 == true then
  c2 = false
  c3 = false
  c4 = false
  term.setCursorPos(15,13)
  write(">Install ScarletOS<")
  term.setCursorPos(16,14)
  write(" Format Computer")
  term.setCursorPos(16,15)
  write(" About ScarletOS")
  term.setCursorPos(22,16)
  write(" Exit")
 
end

if c2 == true then
  c1 = false
  c3 = false
  c4 = false
  term.setCursorPos(15,13)
  write(" Install ScarletOS")
  term.setCursorPos(16,14)
  write(">Format Computer<")
  term.setCursorPos(16,15)
  write(" About ScarletOS")
  term.setCursorPos(22,16)
  write(" Exit")
end

if c3 == true then
  c1 = false
  c2 = false
  c4 = false
  term.setCursorPos(15,13)
  write(" Install ScarletOS")
  term.setCursorPos(16,14)
  write(" Format Computer")
  term.setCursorPos(16,15)
  write(">About ScarletOS<")
  term.setCursorPos(22,16)
  write(" Exit")
end

if c4 == true then
  c1 = false
  c2 = false
  c3 = false
  term.setCursorPos(15,13)
  write(" Install ScarletOS")
  term.setCursorPos(16,14)
  write(" Format Computer")
  term.setCursorPos(16,15)
  write(" About ScarletOS")
  term.setCursorPos(22,16)
  write(">Exit<")
end
end
function logo()
slPrint("=================================================")
slPrint("				    ScarletOS				    ")
slPrint("=================================================")
slPrint("		  _____	    _____	 _____  ")
slPrint("		 /   __\	  /  _  \   /   __\ ")
slPrint("		 \___  /	 |  | |  |  \___  / ")
slPrint("		 /__   \  _  |  |_|  |  /__   \ ")
slPrint("		 \_____/ |_|  \_____/   \_____/ ")
slPrint("=================================================")
slPrint("    Installer Version 1.0			 ")
slPrint("=================================================")
end
function slPrint(text)
textutils.slowPrint(text)
end
function anyKey()
while true do
  event, param1 = os.pullEvent()
  if event == "key" then
   break
  end
end
return param
end
function copyFiles()
fs.copy("", "")
end
--API Variables
version = v1.0.0
--Actual Install
clearS()
mainmenu()

This is my code. When I launch it, it comes up with the error "Multiple Points." What does that mean?
Advert #2
Posted 15 February 2012 - 01:24 AM
I haven't found out why you get Multiple Points yet, but I'll point out something about your logo: In doublequote, and quote strings, the character escapes the next character.
Hence, when you print your logo, you'll find that some of the s are missing.
You should also use "term.write" instead of "write".

Try fixing this, then see if anything changes. I'll look into this multiple points error meanwhile.

Multiple points error is caused by your version string:



--API Variables
version = v1.0.0
--Actual Install

--API Variables -- Fixed
version = "v1.0.0"
--Actual Install

Put it in quotes, as shown above.
Edited on 15 February 2012 - 12:34 AM
Xemiru #3
Posted 15 February 2012 - 01:57 AM
Alright, thanks.

But what other way can I write the logo?
Advert #4
Posted 15 February 2012 - 02:00 AM
I'd use
[[string]]

Here's an except, from tmart:

Edit: Forums doesn't like whitespace, as usual.

See it here: http://pastebin.com/nuX33xq7

I'm using it at line 22-34, to draw ascii art.
Edited on 15 February 2012 - 01:02 AM
Xemiru #5
Posted 15 February 2012 - 02:01 AM
loltrollmart
Dang, you respond fast. o-o;
But thanks. :)/>/>
Advert #6
Posted 15 February 2012 - 02:03 AM
You can read more about different methods of creating strings, here: http://lua-users.org...StringsTutorial

You're welcome, feel free to shoot any other questions you may have.
Xemiru #7
Posted 15 February 2012 - 02:07 AM
Still getting the Multiple Points error.


--FILE installAPI
--Installer API Functions
function clearS()
term.clear()
term.setCursorPos(1,1)
end
function logo()
slPrint("=================================================")
slPrint("				    ScarletOS				    ")
slPrint("=================================================")
slPrint("[[		  _____	    _____	 _____  ]]")
slPrint("[[		 /   __\	  /  _  \   /   __\ ]]")
slPrint("[[		 \___  /	 |  | |  |  \___  / ]]")
slPrint("[[		 /__   \  _  |  |_|  |  /__   \ ]]")
slPrint("[[		 \_____/ |_|  \_____/   \_____/ ]]")
slPrint("=================================================")
slPrint("    Installer Version 1.0			 ")
slPrint("=================================================")
end
function slPrint(text)
textutils.slowPrint(text)
end
function anyKey()
while true do
  event, param1 = os.pullEvent()
  if event == "key" then
   break
  end
end
return param
end
function copyFiles()
end
function menuControl()
event, param1 = os.pullEvent()

if event == "key" and param1 ~= 28 or param1 ~= 200 or param1 ~= 208 then
  menuControl()
elseif event == "key" and param1 == 28 and c1 == true then
  install()
elseif event == "key" and param1 == 28 and c2 == true then
  cFormat()
elseif event == "key" and param1 == 28 and c3 == true then
  about()
elseif event == "key" and param1 == 28 and c4 == true then
  break
end

if event == "key" and param1 == 200 and c1 == true then
  c1 = false
  c2 = false
  c3 = false
  c4 = true
elseif event == "key" and param1 == 200 and c2 == true then
  c1 = true
  c2 = false
  c3 = false
  c4 = false
elseif event == "key" and param1 == 200 and c3 == true then
  c1 = false
  c2 = true
  c3 = false
  c4 = false
elseif event == "key" and param1 == 200 and c4 == true then
  c1 = false
  c2 = false
  c3 = true
  c4 = false
elseif event == "key" and param1 == 208 and c1 == true then
  c1 = false
  c2 = true
  c3 = false
  c4 = false
elseif event == "key" and param1 == 208 and c2 == true then
  c1 = false
  c2 = false
  c3 = true
  c4 = false
elseif event == "key" and param1 == 208 and c3 == true then
  c1 = false
  c2 = false
  c3 = false
  c4 = true
elseif event == "key" and param1 == 208 and c4 == true then
  c1 = true
  c2 = false
  c3 = false
  c4 = false
end

if c1 == true then
  c2 = false
  c3 = false
  c4 = false
  term.setCursorPos(15,13)
  write(">Install ScarletOS<")
  term.setCursorPos(16,14)
  write(" Format Computer")
  term.setCursorPos(16,15)
  write(" About ScarletOS")
  term.setCursorPos(22,16)
  write(" Exit")
 
end

if c2 == true then
  c1 = false
  c3 = false
  c4 = false
  term.setCursorPos(15,13)
  write(" Install ScarletOS")
  term.setCursorPos(16,14)
  write(">Format Computer<")
  term.setCursorPos(16,15)
  write(" About ScarletOS")
  term.setCursorPos(22,16)
  write(" Exit")
end

if c3 == true then
  c1 = false
  c2 = false
  c4 = false
  term.setCursorPos(15,13)
  write(" Install ScarletOS")
  term.setCursorPos(16,14)
  write(" Format Computer")
  term.setCursorPos(16,15)
  write(">About ScarletOS<")
  term.setCursorPos(22,16)
  write(" Exit")
end

if c4 == true then
  c1 = false
  c2 = false
  c3 = false
  term.setCursorPos(15,13)
  write(" Install ScarletOS")
  term.setCursorPos(16,14)
  write(" Format Computer")
  term.setCursorPos(16,15)
  write(" About ScarletOS")
  term.setCursorPos(22,16)
  write(">Exit<")
end
end
function install()
clearS()
slprint("=================================================")
slprint("WARNING")
slprint("=================================================")
sleep(3)
print("Installing the software will delete any previous\nversion of ScarletOS. Make a backup before\ncontinuing.
anykey()
clearS()
print("=================================================")
print("Install Progress")
print("=================================================")
write("Preparing files")
  slprint("...")
  if fs.exists(disk/mainfiles/startup) and fs.exists() then
   sleep(5)
   term.setCursorPos(18,4)
   print("Complete.")
   sleep(1)
   print("Now installing files...")
   term.setCursorPos(20,6)
   slprint("...")
   copyfiles()
   sleep(15)
   term.setCursorPos(23,6)
  else
   print("Missing files. Install aborted.")
   print("Press any key to continue")
   anykey()
   clearS()
   print("=================================================")
   print("Installation Failed")
   print("=================================================")
   print("We're sorry we couldn't continue your\ninstallation of ScarletOS. Please report the\nerror to Xemiru, the creator of ScarletOS.\nThank you for choosing ScarletOS! Goodbye!")
   print("Press any key to continue.")
   anykey()
   mainmenu()
  end
end
end
--API Variables
version = "v1.0.0"
--FILE startup
--Actual Install
function mainmenu()
os.loadAPI("disk/files/apis/installAPI")
clearS()

logo()
sleep(3)
term.setCursorPos(1,13)
c1 = true
c2 = false
c3 = false
c4 = false

while true do

  print("			    Install ScarletOS")
  print("				 Format Computer")
  print("				 About ScarletOS")
  print("					   Exit")
  menucontrol()
end
end
mainmenu()

I've scanned the code and no signs of any other example of version = v1.0.0.
Casper7526 #8
Posted 15 February 2012 - 02:09 AM
print("Installing the software will delete any previousnversion of ScarletOS. Make a backup beforencontinuing.
That line has no end
Hence by the wierd colors for the code.
Xemiru #9
Posted 15 February 2012 - 02:32 AM
weird*

…(FREAKING FACEWALL)
Thanks. :)/>/> [walks away from 16th hole in the wall.]

EDIT:
But I'm still getting the Multiple Points error. :sadfaic:
Xemiru #10
Posted 15 February 2012 - 02:37 AM
You can read more about different methods of creating strings, here: http://lua-users.org...StringsTutorial

You're welcome, feel free to shoot any other questions you may have.

-only noticed this now-

I don't really do well with looking at a large page where I'm tempted to exit and facedesk for being lazy.
Only way I learned some LUA was with Casper's interactive tutorial. I learn from those simulations.

Sorry if I'm such a noob, guys. D:
Advert #11
Posted 15 February 2012 - 03:23 AM
You don't need to use "" quotes when you use [[[]].

When you get "Too many points", look for periods; you have multiple points unescaped, that are part of a number, e.g 1.0.0

If you're still getting too many points, repost your code.
Espen #12
Posted 15 February 2012 - 12:19 PM
Also in addition to everything that was already mentioned, you have this in your code:
fs.exists(disk/mainfiles/startup)
You forgot to encase the String in quotation marks, it should be:
fs.exists("disk/mainfiles/startup")
Xemiru #13
Posted 15 February 2012 - 07:46 PM
Look at this part of the code..


   print("We're sorry we couldn't continue your\ninstallation of ScarletOS. Please report the\nerror to Xemiru, the creator of ScarletOS.\nThank you for choosing ScarletOS! Goodbye!")
   print("Press any key to continue.")

I think this is it.

I'm at school right now, so I can't check. I'll check back into this later. [like an hour and 14 mins left.]
Xemiru #14
Posted 15 February 2012 - 11:11 PM
…Kill me.

This whole time, I was storing the wrong API in the file folder.

Well, thanks for all the help, I guess. :D/>/>
Advert #15
Posted 15 February 2012 - 11:17 PM
…Kill me.

This whole time, I was storing the wrong API in the file folder.

Well, thanks for all the help, I guess. :D/>/>

Haha, well, glad you found out your problem in the end. :D/>/>
Xemiru #16
Posted 16 February 2012 - 04:19 AM
Mhm. I put a note on my computer saying "Don't be an idiot."
Xemiru #17
Posted 16 February 2012 - 04:29 AM
Aaaaaand a new problem occurs.

attempt to call nil

-___-

Really…

I'll pastebin the code.

startup
http://pastebin.com/MepkrXBb

installAPI
http://pastebin.com/XytZAYUW
Espen #18
Posted 16 February 2012 - 05:14 AM
That warning message should always draw your attention to function calls. More often than not it's a typo in a function name / call or calling a function that isn't defined yet.
In your case you're calling menucontrol with a lowercase 'c', wheareas the function is actually defined as menuControl with a capital 'C'.
Don't feel bad though, happens to all of us. :D/>/>

Edit:
Also, I haven't looked into the loadAPI functionality yet, so I don't know if this might be a problem but:
Normally in Lua you have to define functions before you can use them within other functions, or else you'll also get an "attempt to call nil".
For example, within logo() you're trying to call slPrint(). But that is defined only after the logo() function.
So if the typo from above doesn't seem to be enough to get rid of the "attempt to call nil" error, then make sure that every function you're calling, is actually defined before you're calling it.
Edited on 16 February 2012 - 04:20 AM
Xemiru #19
Posted 16 February 2012 - 02:11 PM
My 12 year old brain has been filled with complication. Lol. I'll take a look into it.

EDIT:
After school, that is.
Wojowu #20
Posted 22 February 2012 - 09:19 PM
I am getting multiple points on this code:

print("Enter number of head shifts:")
v=tonumber(read())
print("")
t=1
a=1
x=0
y=0
p=0
while t<=v do
print("state:"..a.." symbol:"..x%3.." position:"..p)
if a==1 then
if x%3==0 then
  x=math.floor(x/3)
  y=3*y+1
  a=2
  p=p+1
elseif x%3==1 then
  x=3*(x+1)+y%3
  y=math.floor(y/3)
  a=1
  p=p-1
else
  x=3*(x-1)+y%3
  y=math.floor(y/3)
  a=1
  p=p-1
end
else
if x%3==0 then
  x=3*(x+2)+y%3
  y=math.floor(y/3)
  a=1
  p=p-1
elseif x%3==1 then
  x=math.floor(x/3)
  y=3*y+2
  a=2
  p=p+1
else
  x=math.floor(x/3)
  y=3*y
  a=1
  p=p+1
end
end
t=t+1
end
I am new in all these stuff, how to check API? Firstly, this program was shorter. Then I added some lines of code, and multiple points started to appear. When I deleted new lines multiple points still haven't work. All other programs on same computer work
Advert #21
Posted 22 February 2012 - 10:15 PM
I am getting multiple points on this code:

print("Enter number of head shifts:")
v=tonumber(read())
print("")
t=1
a=1
x=0
y=0
p=0
while t<=v do
print("state:"..a.." symbol:"..x%3.." position:"..p)
if a==1 then
if x%3==0 then
  x=math.floor(x/3)
  y=3*y+1
  a=2
  p=p+1
elseif x%3==1 then
  x=3*(x+1)+y%3
  y=math.floor(y/3)
  a=1
  p=p-1
else
  x=3*(x-1)+y%3
  y=math.floor(y/3)
  a=1
  p=p-1
end
else
if x%3==0 then
  x=3*(x+2)+y%3
  y=math.floor(y/3)
  a=1
  p=p-1
elseif x%3==1 then
  x=math.floor(x/3)
  y=3*y+2
  a=2
  p=p+1
else
  x=math.floor(x/3)
  y=3*y
  a=1
  p=p+1
end
end
t=t+1
end
I am new in all these stuff, how to check API? Firstly, this program was shorter. Then I added some lines of code, and multiple points started to appear. When I deleted new lines multiple points still haven't work. All other programs on same computer work

I would guess this is the culprit:

print("state:"..a.." symbol:"..x%3.." position:"..p)
You could try:

print("state:"..a.." symbol:"..(x%3).." position:"..p)
Wojowu #22
Posted 23 February 2012 - 02:57 PM
Now it works. Computer read x%3.. as x modulo 3.. which is number with multiple points. Thanks for help!
Cloudy #23
Posted 23 February 2012 - 05:21 PM
Derp, snip. Missed second page.