Jump to content




Parallel inputs


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

#1 Doyle3694

  • Members
  • 815 posts

Posted 05 October 2012 - 04:36 PM

Hey everyone, I'm making a advanced password program taking many users and passwords and so on and so forth. My prblem is, I want users to be able to ,when they are going to enter their password, either input a string or press the back key to input another username. I discovered parallel api won't do this. Will I have to check for os.pullEvent and then break it down and insert it all into a string, like making my own read()

#2 KaoS

    Diabolical Coder

  • Members
  • 1,510 posts
  • LocationThat dark shadow under your bed...

Posted 05 October 2012 - 06:06 PM

a simple but not very clean method is to make one program ask for the username and then call a second program that asks for the password while having a coroutine listen for key presses, when the requred key is pressed it calls error() which terminates the current program - sending you back to the user prompt. there are more complicated but cleaner methods (developing your own function :(/>) and if you would prefer that let us know

#3 jag

  • Members
  • 533 posts
  • LocationStockholm, Sweden

Posted 05 October 2012 - 06:15 PM

I don't know if I exactly know what you mean, but I think that I've made one before: C1wgp6ex

Raw code:
Spoiler

Ofc if you want to change the way the program checks the password, just change the function checkLogin() to whatever you desire.

Or if you wan't the login() function to return true/false when done (you know, with a limited amount of tries): F4hgGUfL

Raw code:
Spoiler


#4 Doyle3694

  • Members
  • 815 posts

Posted 05 October 2012 - 09:34 PM

will look into coroutine. jagenummerett's code didn'thelp at all, wasn't really waht I ment.

#5 Doyle3694

  • Members
  • 815 posts

Posted 05 October 2012 - 09:35 PM

Also, can someone explain coroutine?





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users