Add a input box with password

This forum is meant for people to share their knowledge by writing their own tutorials for Adventure Maker.

Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support

Add a input box with password

Postby Candle » Mon Oct 10, 2005 6:45 am

Code: Select all
password = "aj4dm8"
Do
  returnvalue = InputBox("Please enter the password to enter the room.","Password")
  Select Case returnvalue

     Case ""
       MsgBox "You have clicked Cancel"
       Exit Do

     Case password
       MsgBox "Passwork OK. Entering the room..."
       Action.GoToFrame "image30"
       Exit Do

     Case Else
       MsgBox "Wrong passord. You will now be asked the password again."

  End select
Loop
 
Please don't PM me questions, ask here in the forums!
``````````````
Between grand theft and a legal fee, there only stands a law degree.
User avatar
Candle
Administrator
 
Posts: 3077
Joined: Sat Feb 07, 2004 2:21 am
Location: Rudy's Bar

Postby Mystery » Fri Feb 17, 2006 12:05 pm

Hi

I'm a beginner and try to make my small adventure games more and more complex. This tutorial helped me very much and I just wanted to say THANK YOU! :)
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

thanx

Postby ahashwi » Mon Jul 31, 2006 11:49 pm

thanks for the help


:mrgreen: :| :mrgreen: :mrgreen: :| :mrgreen: :|
:D :D :D :D :D :D :D :D :D :D :D :oops: :idea:
ahashwi
Junior Member
 
Posts: 11
Joined: Sun Jul 30, 2006 11:40 pm

Password

Postby Roland1958 » Fri Feb 08, 2008 11:18 pm

Hi Candle,

I was trying to find a way to make possible the player be able to answer a question and input a word with the keyboard in the game.
Your code is a good solution.
But the windows popup is ugly. Do you think is possible to make this popup diffrent, for example: size, color, font ...

Thx for your ideas

Roland
Roland1958
Member
 
Posts: 42
Joined: Sun Mar 11, 2007 2:34 pm

Password

Postby Roland1958 » Fri Feb 08, 2008 11:24 pm

Hi Candle,

I was trying to find a way to make possible the player be able to answer a question and input a word with the keyboard in the game.
Your code is a good solution.
But the windows popup is ugly. Do you think is possible to make this popup diffrent, for example: size, color, font ...

Thx for your ideas

Roland
Roland1958
Member
 
Posts: 42
Joined: Sun Mar 11, 2007 2:34 pm

Postby Candle » Sat Feb 09, 2008 12:08 am

Sorry but it would use the standard windows dialog box that window uses.
So what ever theme style the users has on his computer thats what it would use so you can't go by what it looks like on your PC.
Did it on my PC so you see what I mean. is what it looks like on my PC.
Attachments
2008-02-09_170915.jpg
2008-02-09_170915.jpg (10.61 KiB) Viewed 26340 times
Please don't PM me questions, ask here in the forums!
``````````````
Between grand theft and a legal fee, there only stands a law degree.
User avatar
Candle
Administrator
 
Posts: 3077
Joined: Sat Feb 07, 2004 2:21 am
Location: Rudy's Bar

Postby Mystery » Sat Feb 09, 2008 8:59 am

Candle is right, you can't change the look of the pop-up box.

But there is another way by using a textbox instead of a pop-up box.
You find the instructions here:
http://www.adventuremaker.com/phpBB2/vi ... php?t=3365
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Input textbox

Postby Roland1958 » Sat Feb 09, 2008 12:05 pm

Thx Mystery,

I ll try your solution...
Roland1958
Member
 
Posts: 42
Joined: Sun Mar 11, 2007 2:34 pm

Input textbox

Postby Roland1958 » Sat Feb 09, 2008 12:41 pm

Hi again Mystery,
Maybed something is not clear for me...
I have followed your instructions and put your code in Frame Properties and Hotspot Properties...
The input box appears in the right place on the screen and I can type the word... But even if I put a worng word I can click on the second hotspot and go to the next screen... No message to said I typed a wrong word...

What 's wrong?

Thx for your help

Roland
Roland1958
Member
 
Posts: 42
Joined: Sun Mar 11, 2007 2:34 pm

Postby Mystery » Sat Feb 09, 2008 12:48 pm

Hmm, you must have made a little mistake somewhere...
What second hotspot do you mean :?:
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Roland1958 » Sat Feb 09, 2008 1:33 pm

The second hotspot is the one you talk in your post : "Don't forget to add also a hotspot that the player can click to leave the screen"

The Hotspot I use to go to the next frame when I put the right password...
Roland1958
Member
 
Posts: 42
Joined: Sun Mar 11, 2007 2:34 pm

Postby Mystery » Sat Feb 09, 2008 1:36 pm

I see now. :)

Well, you need to have a hotspot that checks if the answer is correct or not. If the answer is correct, the player is taken to the next screen, otherwise there is a message that the password was wrong.

The other hotspot should get the player back to the previous screen, not the one where he is taken when he has put in the correct password. This hotspot is just used so that the player doesn't get "stuck" on the screen with the password window, but can go back, and explore more (or look around more to find that password).

Does this clarification help? Or am I still not clear enough?
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Roland1958 » Sat Feb 09, 2008 1:50 pm

:D Yes things begin clear...
In fact I realize you need to click left with mouse to confirm your choice NOT type "enter" with keybord...
But something strange happend : sometimes it works sometimes I need to click few times and wait before the wrong message appear... Or (if I put the right password) I m taken to the next frame. Do you know this problem?... Is there a reason about that?
Another question, is it possible to have a right message if I put the correct password? Example "Bravo it s the correct response"...
Roland1958
Member
 
Posts: 42
Joined: Sun Mar 11, 2007 2:34 pm

Postby Mystery » Sat Feb 09, 2008 1:54 pm

Yes, you can't use the ENTER key, you need to have a hotspot that checks the password.
To make it more clear to players, you could create an ENTER button hotspot for example next to the password textbox.

Hmmm... it's strange if it doesn't always work as you say - there might still be something wrong.

And for your other question:
Of course! You can just replace the
Action.GoToFrame "FrameName" by
Message" Bravo it's the correct response!"
Last edited by Mystery on Sat Feb 09, 2008 1:55 pm, edited 1 time in total.
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Roland1958 » Sat Feb 09, 2008 1:57 pm

my last question... Is it possible to change the font and background color?

thx for your help
Roland1958
Member
 
Posts: 42
Joined: Sun Mar 11, 2007 2:34 pm

Postby Chromegloss55 » Sat Feb 09, 2008 1:59 pm

Passwords are a nightmare! :D

The code I usually use is:

LoadControl TextBoxObject(1)

TextBoxObject(1).Font.Size = 12
TextBoxObject(1).Font = "Times New Roman"
TextBoxObject(1).PasswordChar = "*"
TextBoxObject(1).Visible = "True"

And then to check the password:

If TextBoxObject(1).Text = Password then Action.GoToFrame"Frame" : i = 1
If i = 0 Then If TextBoxObject(1).Text = "" then MsgBox("Please enter a password") : i = 1
If i = 0 Then if TextBoxObject(1).Text <> Password then MsgBox("Incorrect Password") : TextBoxObject(1).Enabled = False : TextBoxObject(1).Visible = "False" : i = 1

Errr... that probably doesn't help and I might have a mistake(I'm doing this from memory), but I'd say that would create a more versatile system, and you could customize the textbox to look the way you want.
_________________
recesion
Last edited by Chromegloss55 on Tue Feb 24, 2009 3:11 pm, edited 1 time in total.
Chromegloss55
Forum Master
 
Posts: 630
Joined: Sat Nov 03, 2007 2:49 pm
Location: God Knows!

Postby Chromegloss55 » Sat Feb 09, 2008 2:00 pm

You can only change the font and background colour of a textbox...
_________________
economic predictions 2009
Last edited by Chromegloss55 on Tue Feb 24, 2009 3:11 pm, edited 1 time in total.
Chromegloss55
Forum Master
 
Posts: 630
Joined: Sat Nov 03, 2007 2:49 pm
Location: God Knows!

Postby Roland1958 » Sat Feb 09, 2008 2:18 pm

Thx Chromegloss55

Mystery,
I just understand that the Hotspot need to cover all frame. Of course when I clicked outside the hotspot nothing happend :oops:

Sometimes the reason is so simple...

Thx for your topic who help me to make my game more interactiv

Roland
Roland1958
Member
 
Posts: 42
Joined: Sun Mar 11, 2007 2:34 pm

Postby Mystery » Sat Feb 09, 2008 2:20 pm

You're very welcome :)

Well, either your hotspot covers the whole frame, or you make it clear to the players that they need to click a specific hotspot; then it doesn't have to be that big (e.g. a hotspot that says "Enter" or "Check your answer" etc.) ;)
Last edited by Mystery on Sat Feb 09, 2008 2:22 pm, edited 1 time in total.
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Chromegloss55 » Sat Feb 09, 2008 2:22 pm

Have fun making great games Roland1958, and make sure to send me a free copy(I love getting stuff for free!) :D
_________________
Islam Forum
Last edited by Chromegloss55 on Tue Feb 24, 2009 3:11 pm, edited 1 time in total.
Chromegloss55
Forum Master
 
Posts: 630
Joined: Sat Nov 03, 2007 2:49 pm
Location: God Knows!

Postby Roland1958 » Sat Feb 09, 2008 6:51 pm

EDIT by Candle
Please post in the right forum.
Roland1958
Member
 
Posts: 42
Joined: Sun Mar 11, 2007 2:34 pm

Postby Mystery » Sat Feb 09, 2008 7:09 pm

Roland, to keep things tidy on this forums, please try to post in the appropriate topic.
Your previous questions were correct here, but if you would like to announce a new game that you have made, please make a new thread about it here.
http://www.adventuremaker.com/phpBB2/viewforum.php?f=5

Thank you :)

And btw, you cannot attach an image with the link to your folder on your pc. Either you need to upload the image here, or use a file host, and then add the link here.
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Input Box

Postby Roland1958 » Sat Feb 09, 2008 8:06 pm

Sorry Mystery
I ll be more carefull
I just wanted reply to the last post.... nothing more...

Here is my test about input box


http://www.histart.stools.net/images/essai.rar
Roland1958
Member
 
Posts: 42
Joined: Sun Mar 11, 2007 2:34 pm

Postby Mystery » Sat Feb 09, 2008 8:36 pm

Do you need somebody to test it because there is a problem, or did you upload it as example for others?
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Roland1958 » Sat Feb 09, 2008 9:15 pm

Sorry If it was not clear.
When I say test I mean an example.
Essai is an example what I made with your code to insert an inputbox with a question for the player.

Be indulgent with me my first language is french...


Roland
Roland1958
Member
 
Posts: 42
Joined: Sun Mar 11, 2007 2:34 pm

Postby Mystery » Sat Feb 09, 2008 9:17 pm

No problem, and thanks for the clarification :)

(See, if I'm not sure if I have understood something correctly, I just ask ;))
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Roland1958 » Sat Feb 09, 2008 10:33 pm

Chromegloss55
Could you say me how I can change the color of the texbox?

Thx
Roland1958
Member
 
Posts: 42
Joined: Sun Mar 11, 2007 2:34 pm

Postby Mystery » Sun Feb 10, 2008 12:05 am

To make it yellow, use:
TextBoxObject(1).BackColor = vbYellow

To make it red, use:
TextBoxObject(1).BackColor = vbRed

etc. :)
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Roland1958 » Sun Feb 10, 2008 10:05 am

Thx Mystery,
That means I can only use the 4 primary color (blue yellow green and red) no more?
Roland1958
Member
 
Posts: 42
Joined: Sun Mar 11, 2007 2:34 pm

Postby Mystery » Sun Feb 10, 2008 2:18 pm

I know that the following colors can be used:
vbBlack
vbRed
vbGreen
vbYellow
vbBlue
vbMagenta
vbCyan
vbWhite

Maybe there is a way to use other colors, but I'm not sure, and I don't know how to do it if it's possible.
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Next

Return to Post Your Own Tutorials

Who is online

Users browsing this forum: No registered users and 0 guests

cron