TextBoxObject

This forum is meant for requesting technical support or reporting bugs.

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

TextBoxObject

Postby mercedes » Fri May 27, 2011 10:43 am

Hey there...

I'm trying to use this code..As i have a million times..I have a number pad..and the user has to enter in the right numbers.

Only this time..I want it to display in the textboxobject..

The original code calls for a 'message box'..to pop up..and say "wrong"..ect---when you press Enter button..


I want the message "wrong" to say it in the actual textbox..

Anything I try..won't work..using text..

I don't really like message boxes..or using the message at the bottom...It would look so much nicer if it displayed in the texboxobject itself..:(

This is the original tutorial..

http://www.adventuremaker.com/phpBB2/viewtopic.php?t=3638&highlight=codebox
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby reneuend » Fri May 27, 2011 1:39 pm

I used the textboxobject in my "love meter" game. What exactly are you having issues with?

Here is an example piece:

Code: Select all
...
...
  Action.LoadControl TextBoxObject(num_questions+1)
  TextBoxObject(num_questions+1).Move 70*15,430*15,350*15,10*15
  TextBoxObject(num_questions+1).Text = "Score: " & num_correct & " (" & percent_correct & "%)"
  TextBoxObject(num_questions+1).Visible = True
...
...


Note: I had several textboxobjects that held the questions, score, etc.
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2690
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA

Postby mercedes » Sat May 28, 2011 12:43 am

This is the original code for the Enter button;

Code: Select all
If ConvertToNumber(TextBoxObject(1).text)= 1234 Then
MsgBox "You got it"
Else
MsgBox "try again"
TextBoxObject(1).text=""
End If


I don't want a message box to pop up..How can I convert that to TEXT to appear in the textboxobject..


I'll try yours..but honestly i don't quiet understand it..

Should I make variables for the TEXT..similar to the way you did for the score to appear..?

**EDIT**
Never mind..I figured it out..so simple it was ridiculous..lol..

If TextBoxObject(1).text= 2579 Then
TextBoxObject(1).Text= "Enter"
Else
TextBoxObject(1).Text = "Wrong"
End If

It was the this part..TextBoxObject(1).text=""
It was there to clear the text up...once they entered in the wrong sequence..so 'Wrong" was never appearing..

I just left it in a Clear button..instead..
I also took out converttonumber too

...I'll just force them to go to another frame..if they get it right..See if that works..:D

Thx..Renuend..hopefully all goes well now..
Last edited by mercedes on Sat May 28, 2011 1:41 am, edited 1 time in total.
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby reneuend » Sat May 28, 2011 1:39 am

Don't you just love it when you figure it out! :)
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2690
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA

Postby mercedes » Mon Jun 06, 2011 7:26 am

This is not working now--*Grrowwwl*

It's throwing me an error now. A string mismatch..!
I'm moving backwards..not forwards!--I'm French--I'm allowed to say forwards.

Good thing i tested it though..

This is the function in the Procedures..

Code: Select all
Function buttondisplay(buttonnumber)
If ConvertToNumber(TextBoxObject(1).Text)<=999 Then
TextBoxObject(1).text=TextBoxObject(1).text+cstr(buttonnumber)
End If
End Function


This is in the Enter button--
Where you click after clicking numbers on a keypad--Then you click ENTER. To see if the numbers were correct.

It didn't give me an error before..But then again..I never pressed it first.
I usually clicked numbers first..Then I clicked the ENTER button..[which is how its designed to work..
However a user may very well click it..first as well..]

Code: Select all
If TextBoxObject(1).text= 2579 Then
TextBoxObject(1).Text= "Enter"
Else
TextBoxObject(1).Text = ""
End If


I would like to be able to display Text and numbers in this Textboxobject..

I think it's because of the function.. text+cstr(buttonnumber]
But i don't know how to fix it.....haalp..
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby reneuend » Mon Jun 06, 2011 2:42 pm

I'll have to look at this later, unless someone else has time. Too much on my plate right now.

If you need to remind me, send me a PM about it....I'm likely going to forget this thread once I finish typing this message! :?
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2690
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA

Postby Lyberodoggy » Mon Jun 06, 2011 3:25 pm

mercedes wrote:This is not working now--*Grrowwwl*

It's throwing me an error now. A string mismatch..!
I'm moving backwards..not forwards!--I'm French--I'm allowed to say forwards.

Good thing i tested it though..

This is the function in the Procedures..

Code: Select all
Function buttondisplay(buttonnumber)
If ConvertToNumber(TextBoxObject(1).Text)<=999 Then
TextBoxObject(1).text=TextBoxObject(1).text+cstr(buttonnumber)
End If
End Function


This is in the Enter button--
Where you click after clicking numbers on a keypad--Then you click ENTER. To see if the numbers were correct.

It didn't give me an error before..But then again..I never pressed it first.
I usually clicked numbers first..Then I clicked the ENTER button..[which is how its designed to work..
However a user may very well click it..first as well..]

Code: Select all
If TextBoxObject(1).text= 2579 Then
TextBoxObject(1).Text= "Enter"
Else
TextBoxObject(1).Text = ""
End If


I would like to be able to display Text and numbers in this Textboxobject..

I think it's because of the function.. text+cstr(buttonnumber]
But i don't know how to fix it.....haalp..


You have removed the ConvertToNumber from the if condition. That results in an integer being compared to a string. Therefore the mismatch.



Code: Select all
If ConvertToNumber(TextBoxObject(1).text)= 1234 Then
TextBoxObject(1).text="You got it"
Else
TextBoxObject(1).text="try again"
disabled=1
CreateTimedEvent 1, "TextBoxObject(1).text="""":disabled=0", false
End If


Create a global integer named disabled and change the procedure to

Code: Select all
Function buttondisplay(buttonnumber)
If ConvertToNumber(TextBoxObject(1).Text)<=999 and disabled=0 Then
TextBoxObject(1).text=TextBoxObject(1).text+cstr(buttonnumber)
End If
End Function


That's if you want to prevent the user from using the keypad while the "try again" message is being displayed.
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby mercedes » Tue Jun 07, 2011 4:23 am

I love it!...It works perfectly!

...If they click the Enter button--prior to entering any buttons..or if they get it wrong..

...it says ERROR...[which is what i wrote]..And ENTER-[a door opens] if they get it right..yayyy...:D:D

The error part looks really good though in the codebox....was..Prett-y happy about that..lol

Thank you!!!
Now hopefully all goes well..or you may hear from me again.. :shock:
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~


Return to Adventure Maker Technical Support and Bug Reports

Who is online

Users browsing this forum: No registered users and 1 guest

cron