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.

DarkBASIC Discussion / Can DB input Return for itself?

Author
Message
Los
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Location:
Posted: 24th Feb 2005 08:51
The scancode()=28 is for Return. This works with IF scancode() equals. I tried this.



It doesn't recognise it. What this was essentially doing was cancelling the input command then displaying the input text as a different colour. It asks for an input but presses return for itself, then displays again with yellow text. You could do it again and change the text to black. Any way? Canceling INPUT?

" Ahh to finish something! My boy, have you ever accomplished anything? "
NanoBrain
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 24th Feb 2005 13:18
Hello Los,

I'm not completely sure what you are trying to say about the color change. However, I do want to point out that scancode()=28 is not a recognisable command in DarkBasic. The () brackets mean that there will be a value returned to you to use. Therefore, you would only use scancode() if you wanted to get the user's currently pressed key's code.

If I am correct, you are wanting the computer to, in Lamen's terms, "press the return key for you"? If this be the case, then create a function that evaluates the situation as a Boolean value of either "true" or "false". If the value is "true", then run the function which simulates the return key being pressed by the user.

+NanoBrain+
Los
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Location:
Posted: 24th Feb 2005 17:48 Edited at: 24th Feb 2005 17:54
Lamen, or er, YOU.. are correct. Now tell me if it's possible to do that I also don't get how true or false would help. Computer asks for an input. Does the user want to have the input? no... send false to the function and let the function cancel the input command.
cheers

[edit]
big wow. just tried another scancode hack and I now know how to give your input specifics!

do
input "hello",value
`scancode(28)
loop

Will only take a number. If you use

do
input "hello",value$
`scancode(28)
loop

it takes everything. Can you see why?
Yeah the scancode(28) didn't work I thought it may return ENTER but it didn't. damn.

" Ahh to finish something! My boy, have you ever accomplished anything? "
P Schnell
20
Years of Service
User Offline
Joined: 13th Feb 2005
Location:
Posted: 25th Feb 2005 07:53 Edited at: 25th Feb 2005 07:54
Isn't it lay man's?

Anyway, you can't force a key to be pressed, so you would have to do something like:



Of course you could use a C++ app to synthesize the key, but that's a bit beyond you now.

And about the inputs you posted, if the variable is a string, it can only be typed as a string, and will be calculated as a string, and an integer can only be an integer, same with reals.

So if you had:

Input "Input: ",in
in=in+in
print in

and you input 2, 2+2=4, and 4 would be printed.

If you had:

Input "Input: ",in$
in$=in$+in$
print in$

and you input 2a, it would calculate as a string, addin the two together, "2a"+"2a"="2a2a" and 2a2a would be printed.

If you had:

Input "Input: ",in#
in#=in#+in#
print in#

since reals can have decimals, you could enter 2.4, and 2.4+2.4=4.8, and 4.8 would be printed.

If you have an integer, you can only type 0-9.
If you have a real, you can type 0-9 and decimals.
If you had a string, you could type ant character, which means 0-9, a-z, A-Z, and all the spaces and symbols, but not things like F8 of SHIFT.

Login to post a reply

Server time is: 2025-05-23 19:21:23
Your offset time is: 2025-05-23 19:21:23