Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / input without prompt

Author
Message
qwe
21
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 4th Sep 2003 03:59
In qbasic, you could type a$ = input$(1)
so the user can input a variable without any prompt on the screen. How can I do this in dark basic?

thanks
andrew11
21
Years of Service
User Offline
Joined: 23rd Feb 2003
Location: United States
Posted: 4th Sep 2003 05:03 Edited at: 4th Sep 2003 05:14
I don't know of any commands like that build-in to DBP. However, I wrote a quick function to do it. Not quite the same, but works anyway.

Function:


Example code:


"All programmers are playwrites and all computers are lousy actors" -Anon
[img]Visit my site![/img]
qwe
21
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 4th Sep 2003 18:49
I'm not sure you understand completely. All I want to do is have a user be able to input a variable, without anything on the screen. As in, the screen can be blank, and also waiting for him to input, without a ? or a whatever the blinking line that shows where ur text will appear is called. You need to do this in many games, like in a 3d game W goes forward, it doesnt give a cursor and yo press W and enter, u press W once and W is inputed.
qwe
21
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 4th Sep 2003 18:53
Basicly no need to press enter after inputing is what im getting at
ReD_eYe
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 4th Sep 2003 19:55 Edited at: 4th Sep 2003 19:56
andrew11's code does that! it just needed some tweaking


try that out


the_winch
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 4th Sep 2003 20:14
You need to use scan code(). There is an image somewhere with all the keys and there scan codes, hopefully a helpfull person will post it.
Use this code to print the scan codes to the screen

The scan code for the w key is 17 so in your code you would have.
do
if scancode() = 17
do what ever it is you want to do when the w key is pressed.
endif
loop
ChipOne
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Canada
Posted: 4th Sep 2003 20:52
i also added a code snippet to the code base. the link is here:
input examples

cheers

-= i only do what my rice krispies tell me to do =-
andrew11
21
Years of Service
User Offline
Joined: 23rd Feb 2003
Location: United States
Posted: 4th Sep 2003 23:43
You know Chris, this isn't QBASIC. DB is much more powerful. You can use commands like Upkey(), Downkey(), etc. or scancode like the_winch said. Those commands are much faster than my input routine.

"All programmers are playwrites and all computers are lousy actors" -Anon
[img]Visit my site![/img]
qwe
21
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 8th Sep 2003 18:35
Thanks. I think I will see what I can do with scancode.
qwe
21
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 12th Sep 2003 00:28
your function worked perfectly
Orion Pax
21
Years of Service
User Offline
Joined: 17th Sep 2003
Location:
Posted: 18th Sep 2003 08:23 Edited at: 18th Sep 2003 08:24
i know this is thread is bout a week old....but i had finally made my own snippet of code that does exactly what your ask....no prompt....the text type out as you type it and your still free to do what ever else you want...no program freezing while it waits for you to type your input

now in my code it uses a 800x600 screen and types out the text on the bottom 5 lines of the screen....and scrolls it up....now in mine you have to press enter for it to scroll up.....from the way you described that this is more what you want....but maybe not....let me know what you think....

http://darkbasic.thegamecreators.com/?m=forum_view&t=16911&b=6
zzabb
21
Years of Service
User Offline
Joined: 25th Apr 2003
Location: Seattle, USA
Posted: 18th Sep 2003 08:55 Edited at: 18th Sep 2003 09:11
this was a code i wrote to get rid of the cursor and use the back space to clear
hit enter to leave/save just like the input command

works pretty much like the input command except you can have other things goin on in the loop (i had the mouse selecting things)


(the screen will be blank till ya type something)

My advice is free -
unfortunately you get what you pay for (-:

Login to post a reply

Server time is: 2024-11-25 08:22:20
Your offset time is: 2024-11-25 08:22:20