Replacing a number with an asterisk.

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
gillilandd
Posts: 18
Joined: Wed Apr 04, 2007 7:48 pm
Location: Sarasota High School, Sarasota, FL
Contact:

Replacing a number with an asterisk.

Post by gillilandd » Mon Feb 25, 2008 9:55 pm

I am authoring a program for my students and want to have them stop, show me their work, and I type in a code (0051) before they can proceed on.
Here is what I have:

on mouseUp
ask "Now that you have your stamp, have your teacher type in the code to continue."
put it into rightcode
if rightcode is "0051" then go next
if rightcode is not "0051" then answer "No - you cannot proceed on until you type in the correct code!"
end mouseUp


The script is easy but I don't want the code appearing on screen - instead I want to replace each number with an asterisk so the students cannot see what I am typing.
I've searched the forum and cannot find anything that will help me do this. Anyone have any suggestions?
Thanks,
Doug Gilliland

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1236
Joined: Sat Apr 08, 2006 1:10 pm
Location: Zurich
Contact:

Post by BvG » Mon Feb 25, 2008 10:17 pm

The simplest way is:

Code: Select all

ask password "enter the secret number"
if it <> "" and it = "0051" then
  --do your thing here
end if
More complex is using the keydown message because you need to make it all yourself.
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Post by Klaus » Mon Feb 25, 2008 10:24 pm

Hi gillilandd,

try this:

Code: Select all

on mouseUp 
  ask password CLEAR "Now that you have your stamp, have your teacher type in the code to continue." 
  ## Needs to be CLEAR or you cannot check it afterwards, see the docs!
  put it into rightcode 
  if rightcode = "0051" then 
     go next 
  else
   answer "No - you cannot proceed on until you type in the correct code!" 
 end if
end mouseUp



Best

Klaus

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1236
Joined: Sat Apr 08, 2006 1:10 pm
Location: Zurich
Contact:

Post by BvG » Mon Feb 25, 2008 11:10 pm

Damn, forgot the clear, that's what I get for suggesting stuff i haven't used since years :(
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

gillilandd
Posts: 18
Joined: Wed Apr 04, 2007 7:48 pm
Location: Sarasota High School, Sarasota, FL
Contact:

Post by gillilandd » Mon Feb 25, 2008 11:36 pm

Thanks to you both - the script Klaus posted works great.
Doug Gilliland

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Tue Feb 26, 2008 7:01 pm

Hi,

I created a little stack with a password field, which you can copy into your own project. Go to the Economy-x-Talk homepage (see below), click on the Developer link on the left and find the Password Fields stack the bottom of that page.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”