Jump to content




Can some one fix my Computer craft mainframe?


10 replies to this topic

#1 Nom

  • Members
  • 7 posts

Posted 14 December 2013 - 03:06 AM

Hi im new to lua,
But I just spent 1 hour trying to make this advanced door system with a main frame (NMF) which has its own api!
The problem is I can't get the program to work properly.
Please can some one help fix the issues in the coding.
Here is the link to files: https://www.mediafir...m8978z91ed54r38
Thanks,
Nom

#2 nolongerexistant

  • Validating
  • 201 posts
  • LocationNetherlands

Posted 14 December 2013 - 04:41 AM

You should really use Pastebin to upload your scripts. No one is going to download it from Mediafire.

#3 Csstform

  • Members
  • 410 posts
  • LocationU.S.A.

Posted 14 December 2013 - 09:54 AM

Alright. Let's see if I can help.

When you call
read("*")
it should be
read()

Also, after you call NFS.Start(), you have no way of seeing if the user typed either login or admin_login. I would suggest something like this:
i = 1
while i == 1 do
   input = read()
   if input == "login" then
      i = 0
      --code here
   elseif input == "admin_login" then
      i = 0
      --code here
   else
      print("Invalid input!")
   end
end


#4 MKlegoman357

  • Members
  • 1,170 posts
  • LocationKaunas, Lithuania

Posted 14 December 2013 - 10:01 AM

View PostCastform, on 14 December 2013 - 09:54 AM, said:

When you call
read("*")
it should be
read()

Maybe he doesn't want anyone to see what he is typing?

#5 Csstform

  • Members
  • 410 posts
  • LocationU.S.A.

Posted 14 December 2013 - 10:08 AM

Aha! That's what it does! I've tried that so many times, and gotten an error each time though...

#6 Nom

  • Members
  • 7 posts

Posted 14 December 2013 - 01:39 PM

View PostCastform, on 14 December 2013 - 09:54 AM, said:

Alright. Let's see if I can help.

When you call
read("*")
it should be
read()

Also, after you call NFS.Start(), you have no way of seeing if the user typed either login or admin_login. I would suggest something like this:
i = 1
while i == 1 do
   input = read()
   if input == "login" then
      i = 0
      --code here
   elseif input == "admin_login" then
      i = 0
      --code here
   else
      print("Invalid input!")
   end
end
Yeah but that ruins the point of using a api.

#7 Csstform

  • Members
  • 410 posts
  • LocationU.S.A.

Posted 14 December 2013 - 03:59 PM

Didnt realize that was the API. Can you post the errors you are getting?

#8 Nom

  • Members
  • 7 posts

Posted 14 December 2013 - 04:15 PM

View PostCastform, on 14 December 2013 - 03:59 PM, said:

Didnt realize that was the API. Can you post the errors you are getting?
ok I'll try to, did you get the errors in the startup script? I'm currently in a car travelling from Sydney to Quensland (Australia) so when I get to the place I'm stayin at I'll try to find the errors in the Api(NMF).

View PostSnakybo, on 14 December 2013 - 04:41 AM, said:

You should really use Pastebin to upload your scripts. No one is going to download it from Mediafire.
Ok I'll use pastebin instead.

#9 ardera

  • Members
  • 503 posts
  • LocationGermany

Posted 14 December 2013 - 05:28 PM

Well the thing is, you're not doing anything.

you load the NMF API,
and call the function "start", which does
print some options on the screen.

that's all.

I think you wanted, that the user chooses an option now, but you're not doing it.

You're missing something like
print("Enter either login or admin login:")
local whichlogin = read()
if whichlogin == "login" then
  NMF.Login()
elseif whichlogin == "admin login" then
  NMF.Admin_Login()
end
in your NMF.start function.

Same inside your Admin_Login function:
you only define to functions there, you give your user no chance to choose what function he wants to choose.

Also, in your startup file, if the user doesn't enter start, he will get to the shell. you should add an else, which reboots the pc. You could make a while loop too - if you know how to.

#10 Nom

  • Members
  • 7 posts

Posted 15 December 2013 - 02:29 PM

View Postardera, on 14 December 2013 - 05:28 PM, said:

Well the thing is, you're not doing anything.

you load the NMF API,
and call the function "start", which does
print some options on the screen.

that's all.

I think you wanted, that the user chooses an option now, but you're not doing it.

You're missing something like
print("Enter either login or admin login:")
local whichlogin = read()
if whichlogin == "login" then
  NMF.Login()
elseif whichlogin == "admin login" then
  NMF.Admin_Login()
end
in your NMF.start function.

Same inside your Admin_Login function:
you only define to functions there, you give your user no chance to choose what function he wants to choose.

Also, in your startup file, if the user doesn't enter start, he will get to the shell. you should add an else, which reboots the pc. You could make a while loop too - if you know how to.
i don't get it.

#11 Bomb Bloke

    Hobbyist Coder

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

Posted 15 December 2013 - 06:45 PM

View PostSnakybo, on 14 December 2013 - 04:41 AM, said:

You should really use Pastebin to upload your scripts.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users