This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-BASIC subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. TI-Basic => TI-BASIC
United-TI Archives -> TI-Basic
 
    » Goto page 1, 2, 3, 4  Next
» View previous topic :: View next topic  
Author Message
NETWizz
Byte by bit


Bandwidth Hog


Joined: 20 May 2003
Posts: 2369

Posted: 24 Nov 2003 04:35:13 pm    Post subject:

Input "Password: ",str1

str1 is found under vars -> Strings -> Str1

Then you will do something like this:

While Str1="SOME TEXT"
;do stuff
End
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 24 Nov 2003 04:38:03 pm    Post subject:

To have it do one thing if you press 1 and another if you press 2, do:

Code:
:getKey -> K
:If K = 92 (getKey value for 1)
:Then
(whatever)
:End
:If K = 93 (getKey value for 2)
:Then
(whatever)
:End


If you want to use letters, not numbers, use strings (7 in the Vars menu).

Code:
:Input Str1
:If Str1 = "put the password here"
:Then
(whatever - correct password)
:Else
(whatever - wrong password)
:End


There are various ways to encode the password so people do not find out by looking in the program but this is basically it.

EDIT: sorry JBirk I was busy writing and didn't notice you answering.


Last edited by Guest on 24 Nov 2003 04:39:03 pm; edited 1 time in total
Back to top
Adm.Wiggin
aka Tianon


Know-It-All


Joined: 02 Jun 2003
Posts: 1874

Posted: 24 Nov 2003 05:32:06 pm    Post subject:

ok, here you go :
Code:
:Input Str1
:If Str1="Whatever"
:Then
:Goto A
:Else
:ClrHome
:Stop
:End
that will work, BUT NEVER USE A GOTO IN AN IF-THEN-END/ELSE STATEMENT!

this would be the proper way :

Code:
:Input Str1
:If Str1="Whatever"
:Goto A
:If Str1<>"Whatever"
:Then
:ClrHome
:Stop
:End
Smile
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 24 Nov 2003 07:15:46 pm    Post subject:

First question - you did not wait for the user to input a key. Replace getKey -> K with

Code:
:Repeat Ans
:getKey ->K
:End

which will wait until a key is pressed to go on. Also, as I believe has been said, Never use a Goto inside an If statement.

To change the ? for the input write

Code:
:Input "Password: ",Str1


Last edited by Guest on 24 Nov 2003 07:15:55 pm; edited 1 time in total
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 25 Nov 2003 09:17:42 am    Post subject:

ClrHome
Repeat Ans
getKey
End
If Ans=92:Goto A
If Ans=93:Goto B
Lbl A:Disp "HELLO!
Goto Q //skip B
Lbl B:Disp "HELLOES!!1!
Lbl Q
Disp "END OF PROGRAM!


Last edited by Guest on 25 Nov 2003 09:19:57 am; edited 1 time in total
Back to top
Spyderbyte


Advanced Member


Joined: 29 May 2003
Posts: 372

Posted: 25 Nov 2003 05:23:35 pm    Post subject:

ClrHome
Repeat Ans
getKey
End
If Ans=92:Goto A
If Ans=93:Goto B
Goto C
Lbl A:Disp "HELLO!
Goto Q //skip B
Lbl B:Disp "HELLOES!!!!
Lbl C
(Whatever you want to happen if they press a different key)

Lbl Q
Disp "END OF PROGRAM!

Or, if you just want it to end if they press a different key, replace Goto C with Goto Q.

And, if you want to, you could optomize it to this:

ClrHome
Repeat Ans
getkey
End
If Ans=92
Disp "HELLO!"
If Ans=93
Disp "HELLOES!!!!!!"
Disp "END OF PROGRAM!

But don't worry about it if you don't want to.

Spyderbyte


Last edited by Guest on 25 Nov 2003 05:23:53 pm; edited 1 time in total
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 26 Nov 2003 10:51:21 am    Post subject:

True, using labels for just one line of code would be 'bad'. Smile
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 27 Nov 2003 08:43:51 am    Post subject:

ClrHome
Repeat Ans=92 or Ans=93
getKey
End
If Ans=92:Goto A
If Ans=93:Goto B
Lbl A:Disp "HELLO!
Goto Q //skip B
Lbl B:Disp "HELLOES!!1!
Lbl Q
Disp "END OF PROGRAM!
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 27 Nov 2003 03:14:53 pm    Post subject:


Code:
:Repeat Ans=92 or Ans=93
:getKey
:End
:If Ans=92
:Then
:Disp "Hello!
:Else
:Disp "Helloes!!1! (what does this mean?)
:End
:"End of program!


Last edited by Guest on 27 Nov 2003 03:15:03 pm; edited 1 time in total
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 27 Nov 2003 03:38:30 pm    Post subject:

No, but you could write your own input routine.

Code:
" " ->Str1
Ans -> Str2
Repeat K=105 or length(Str1)=8
Repeat Ans
getKey->K
End
sum(seq(I,I,1,10)(K={102,92,93,94,82,83,84,72,73,74
If Ans:Then
sub("0123456789",Ans,1 -> Str0
Str1 + Str0 -> Str1
Str2 + "*" -> Str2
Output(1,1,sub(Str2,2,length(Str2)-1
End
End

This is just a sample, it only accepts an input of up to eight numbers 0-9, storing the string in Str1. Hope it helps.


Last edited by Guest on 27 Nov 2003 07:11:48 pm; edited 1 time in total
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 27 Nov 2003 07:35:36 pm    Post subject:

I will warn you though, that is not tested since my calc's batteries are dead... You should check it.
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 27 Nov 2003 08:04:52 pm    Post subject:


Code:
Lbl 0
ClrHome
" " ->Str1
Ans -> Str2
Repeat K=105 or length(Str1)=8
Repeat Ans
getKey->K
End
sum(seq(I,I,1,10)(K={102,92,93,94,82,83,84,72,73,74
If Ans:Then
sub("0123456789",Ans,1 -> Str0
Str1 + Str0 -> Str1
Str2 + "*" -> Str2
Output(1,1,sub(Str2,2,length(Str2)-1
End
End
ClrHome
If Str1 = "12345678" (put the password here)
Goto 1
ClrHome
If you are nice
Goto 0
If you are not nice
Stop
If you are like me
Asm(prgmCLEAR (that is just a program with one line - AsmPrgm, will clear Ram when run)


Last edited by Guest on 27 Nov 2003 08:05:08 pm; edited 1 time in total
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 27 Nov 2003 10:47:52 pm    Post subject:

I was just showing various options for what happens if you get the password wrong

If you are nice: lets you enter the password again.

If you are not nice: Stops

If you are like me: resets the Ram.

Or you could do


Code:
If Str1="12345678"
Then
(the password is correct
Else
(the password is incorrect)
End
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 28 Nov 2003 03:21:54 pm    Post subject:

Newbie wrote:
I put that in, but what happens when you press enter it stops the program. This is my code

:If str1="124
:Then
:prgmTest (which is this program)
:Else
:Stop

When you press enter, you are saying you've finished entering the password. This is to enter a password less than 8 numbers long.

Quote:
Is it possible in basic to put a password screen like the ones in previous replys in text?


Instead of the line saying

Code:
sum(seq(I,I,1,10)(K={102,92,93,94,82,83,84,72,73,74

write

Code:
sum(seq(I,I,1,N)(K={list of keys

where N is the number of keys you could be pressing and 'list of keys' is the getKey values for the keys you could press.
Instead of

Code:
sub("0123456789",Ans,1 -> Str0

write

Code:
sub("string of possible characters",Ans,1 -> Str0


For a program where you can enter text, lowercase text, and numbers, the process is slightly more complicated. I might write one with numbers and uppercase, lowercase, and Russian text (when I have time and batteries).
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 29 Nov 2003 11:28:05 am    Post subject:

No, you can't have the user's input with the input function turn to *'s, you'll have to use a custom input routine.

Last edited by Guest on 29 Nov 2003 11:28:13 am; edited 1 time in total
Back to top
NETWizz
Byte by bit


Bandwidth Hog


Joined: 20 May 2003
Posts: 2369

Posted: 29 Nov 2003 01:27:41 pm    Post subject:

It means if you press the 2 key it will display Hello!, but if you press the 3 key, it will display Helloes!!1!
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 29 Nov 2003 04:10:41 pm    Post subject:

You cannot find the Russian text anywhere. I am going to make an Omnicalc Cyrillic font that will change the accented vowel symbols to Cyrillic characters. Using calcsys, one can get those symbols easily.
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 29 Nov 2003 06:20:08 pm    Post subject:

I've finished and uploaded a Russian font to ticalc.org that should be there soon (What! you say, The only thing that I did not want?!). The rest will have to wait for until I get new batteries Sad .

Last edited by Guest on 29 Nov 2003 07:06:43 pm; edited 1 time in total
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 01 Dec 2003 05:03:25 pm    Post subject:

I have finished the program and uploaded it to ticalc.org. Use is explained in the readme, if you have any questions ask.

Offtopic: Yes, i do play chess, must be a Russian thing. I would say I'm pretty good - I can beat everyone at my high school except one person (whom I can only beat 1/4 of the time).
Back to top
Darth Android
DragonOS Dev Team


Bandwidth Hog


Joined: 31 May 2003
Posts: 2104

Posted: 01 Dec 2003 07:37:36 pm    Post subject:

i have a getkey routine for the graphscreen. fast, blinking cursor, letters like @#$%&~` ALL IN BASIC.
echos the input at A,B (same as if you did a Text(A,B,"text"))
only lets users input E amout of chars
puts input in Str1
will get a link soon...
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    » Goto page 1, 2, 3, 4  Next
» View previous topic :: View next topic  
Page 1 of 4 » All times are UTC - 5 Hours

 

Advertisement