Page 1 of 2

Add a input box with password

PostPosted: Mon Oct 10, 2005 6:45 am
by Candle
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
 

PostPosted: Fri Feb 17, 2006 12:05 pm
by Mystery
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! :)

thanx

PostPosted: Mon Jul 31, 2006 11:49 pm
by ahashwi
thanks for the help


:mrgreen: :| :mrgreen: :mrgreen: :| :mrgreen: :|
:D :D :D :D :D :D :D :D :D :D :D :oops: :idea:

Password

PostPosted: Fri Feb 08, 2008 11:18 pm
by Roland1958
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

Password

PostPosted: Fri Feb 08, 2008 11:24 pm
by Roland1958
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

PostPosted: Sat Feb 09, 2008 12:08 am
by Candle
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.

PostPosted: Sat Feb 09, 2008 8:59 am
by Mystery
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

Input textbox

PostPosted: Sat Feb 09, 2008 12:05 pm
by Roland1958
Thx Mystery,

I ll try your solution...

Input textbox

PostPosted: Sat Feb 09, 2008 12:41 pm
by Roland1958
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

PostPosted: Sat Feb 09, 2008 12:48 pm
by Mystery
Hmm, you must have made a little mistake somewhere...
What second hotspot do you mean :?:

PostPosted: Sat Feb 09, 2008 1:33 pm
by Roland1958
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...

PostPosted: Sat Feb 09, 2008 1:36 pm
by Mystery
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?

PostPosted: Sat Feb 09, 2008 1:50 pm
by Roland1958
: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"...

PostPosted: Sat Feb 09, 2008 1:54 pm
by Mystery
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!"

PostPosted: Sat Feb 09, 2008 1:57 pm
by Roland1958
my last question... Is it possible to change the font and background color?

thx for your help

PostPosted: Sat Feb 09, 2008 1:59 pm
by Chromegloss55
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

PostPosted: Sat Feb 09, 2008 2:00 pm
by Chromegloss55
You can only change the font and background colour of a textbox...
_________________
economic predictions 2009

PostPosted: Sat Feb 09, 2008 2:18 pm
by Roland1958
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

PostPosted: Sat Feb 09, 2008 2:20 pm
by Mystery
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.) ;)

PostPosted: Sat Feb 09, 2008 2:22 pm
by Chromegloss55
Have fun making great games Roland1958, and make sure to send me a free copy(I love getting stuff for free!) :D
_________________
Islam Forum

PostPosted: Sat Feb 09, 2008 6:51 pm
by Roland1958
EDIT by Candle
Please post in the right forum.

PostPosted: Sat Feb 09, 2008 7:09 pm
by Mystery
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.

Input Box

PostPosted: Sat Feb 09, 2008 8:06 pm
by Roland1958
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

PostPosted: Sat Feb 09, 2008 8:36 pm
by Mystery
Do you need somebody to test it because there is a problem, or did you upload it as example for others?

PostPosted: Sat Feb 09, 2008 9:15 pm
by Roland1958
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

PostPosted: Sat Feb 09, 2008 9:17 pm
by Mystery
No problem, and thanks for the clarification :)

(See, if I'm not sure if I have understood something correctly, I just ask ;))

PostPosted: Sat Feb 09, 2008 10:33 pm
by Roland1958
Chromegloss55
Could you say me how I can change the color of the texbox?

Thx

PostPosted: Sun Feb 10, 2008 12:05 am
by Mystery
To make it yellow, use:
TextBoxObject(1).BackColor = vbYellow

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

etc. :)

PostPosted: Sun Feb 10, 2008 10:05 am
by Roland1958
Thx Mystery,
That means I can only use the 4 primary color (blue yellow green and red) no more?

PostPosted: Sun Feb 10, 2008 2:18 pm
by Mystery
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.