Text input code help

Blitz3D Forums/Blitz3D Beginners Area/Text input code help

mintybreath(Posted 2007) [#1]
Hi, i need help with this text input code. I am making a game that is a fake usable computer desktop, and i am making some websites that work when the correct input is given. What happens is you click the input new adress button, bringing up a input box, where you type in whatever. My problem starts when the box is open, and you type something in, it does not end the input like i want. How do you make the input end so that the program continues?

Thanks for your help!


chwaga(Posted 2007) [#2]
what do you mean by "end"?


mintybreath(Posted 2007) [#3]
I want it to make the input box go away, so that the program continues to run normally. does that clear it up a little better?


b32(Posted 2007) [#4]
How do you make the input box ? Can you post some example code ?


Yahfree(Posted 2007) [#5]
heres a basic input field by me:

http://www.blitzbasic.com/codearcs/codearcs.php?code=2006

and heres a more advanced one by b32...

http://www.blitzbasic.com/codearcs/codearcs.php?code=2022

is this what your talking about? a method of input without stopping execution?


mintybreath(Posted 2007) [#6]
If whatwaspicked=abar Then
	Input$=Input$("Enter New Web Adress: ")
		If bored$=Input$ Then
		ShowEntity bored
		Else
	EndIf
EndIf


that is what i am using, and what happens is it stops the program, and even after i input, it just loops back around and keeps the program frozen.

it is not actually a box, i just could not think of the right word

Sorry i am causing alot of confusion. :)


Yahfree(Posted 2007) [#7]
try using my input field... i'll whip up an example in a bit..


b32(Posted 2007) [#8]
Maybe a stupid question, but you did press Enter after entering the input text ? Also, try resetting 'whatwaspicked' to zero again, after the input.


mintybreath(Posted 2007) [#9]
yes i did press enter, lol, and i am not exactly sure what the second meens. Do you meen, change the entitypickmode to 0?


Yahfree(Posted 2007) [#10]
heres an example with my input field...


in your example above your using "Input=Input(blah)" try using "test$=Input$("Enter..")"


b32(Posted 2007) [#11]
Oh .. I see .. when I read this:
"If whatwaspicked=abar Then"
I figured that 'whatwaspicked' was a variable somehow. So, erm .. nm, I don't think that was it.


mintybreath(Posted 2007) [#12]
thanks for all your help, but it did not work. it said, expecting expression and highlighted the "<a href" whole thing in the beginning.


b32(Posted 2007) [#13]
I believe that html tag shouldn't be there .. the line should be more or less the same as the line above, only with "Upper" instead of "Lower". I think it is caused by the site somehow.


mintybreath(Posted 2007) [#14]
...what? al the code did was say New Addy, and display www.myaddress.com below it..

I am just going to clarify my problem. The problem is, when i click the enter new web address button that i made, it opens the input option, then, after i enter the correct input,designated earlier as bored$, the program does not end. What i want to happen is, when you click the enter new web address button, it opens up the input typing line, so you type in "www.boredbb.org/bored" and press enter this ends the program. After that, it shows the entity bored, which is the boredbb webpage.

My problem is it wont end the input line, it just keeps going, and i need it to end, to let the boredbb entity go and show up.

I really appreciate all the help and codes that you are all offering me. :) Really really sorry for the confusion.


b32(Posted 2007) [#15]
The 'www.myadress.com' is an input box. You can use backspace to remove the characters and add new characters by typing.
It is difficult to find out what went wrong, based on the example you posted.
Input$=Input$("Enter New Web Adress: ")
		If bored$=Input$ Then

There are three Input commands in this part. Use:
bored$ = Input$("Web adres:")
if bored$ = "www.something.vr" Then

What I think went wrong, is that the program launches a new Input over and over again.
Suppose you check if the mouse is in a certain area. The Input line appears, you type something in, press Enter. The mouse is still on that certain area, so the program launches a new input box again.
Other ideas could be, use MouseHit() instead of Mousedown() and before using Input, use FlushKeys().


mintybreath(Posted 2007) [#16]
Ok i worked around the problemm by making it so, simply pressing 1 will open the input. but a new problem arrised. When the correct words are inputed, it does not showentity bored. here is the code. it should showentity bored, but it does not, it does nothing. More help would be greatly appreciated!

If KeyHit(2) Then
	FlushKeys()
	Input$=Input$ ("Enter New Web Address: ")
		If bored$=Input$ Then
		ShowEntity bored
		Else
	EndIf
EndIf



Yahfree(Posted 2007) [#17]
Minty, the new address button is to toggle the new address window, try clicking on it. then type the new address, and click on it again to close.

edit: also i don't know why that a herf html tag is in the code? i tried reposting it, (correctly) and it showed up again!

let me try without the codebox:

Edit 2: thats wierd! any ideas?


Yo! Wazzup?(Posted 2007) [#18]
Apparently the fourms think it's an email adress...


mintybreath(Posted 2007) [#19]
Then how do i make it so it opens the adress thing that you gave me, when the enter new address button is pressed? and then how do i make it showentity bored?

Another thing, the period does not work when trying to enter a new adress.

Thanks for the help, i think your code will really help my program

And could someone still answer my last post please? just so i know for reference, or a backup plan or something.


b32(Posted 2007) [#20]
Well .. you could better change the name of variable 'input$' to something else, and then there is 'bored$' and 'bored'. Try this instead:
adres$ = "www.bored.com"
If KeyHit(2) Then
	FlushKeys()
	entered$=Input$ ("Enter New Web Address: ")
		If entered$=adres$ Then
		ShowEntity bored
		Else
	EndIf
EndIf



mintybreath(Posted 2007) [#21]
Yes! it worked! Thanks alot for your help b32. I guess it was just confused or something with all the like words? ill try to avoid that in the future. :)

And thanks you everyone else for all your help! :D