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 / line streaks in text input

Author
Message
Rburke
18
Years of Service
User Offline
Joined: 28th Sep 2006
Location:
Posted: 2nd Jan 2013 17:41 Edited at: 3rd Jan 2013 02:51
Is there a way to get rid of the unattractive streaks while inputting text? Also, is there a way to use ink two times on one printed line so that I can have more than one color in a single line?
Edit: Also want it so that the program only accepts real integers instead of numbers like 22.3. Tips?
Edit 2: Found out that I can add another variable selectionReal and do selection# - selectionReal and use the result to determine if the value returned is greater than 0, indicating if partial numbers were entered. Bold are the new additions:

SET TEXT FONT "Console" : SET TEXT SIZE 15

Input "Select a number between 1 and 100: ", selection$
selection# = VAL(selection$)
selectionReal = selection#
repeat
if selection# < 1 OR selection# > 100 OR (selection# - selectionReal) > 0
Print : Ink RGB(255,100,65),1
Print "'",selection$,"'"," is an Invalid selection." : Ink RGB(255,255,255),1
Input "Select a number between 1 and 100: ", selection$
selection# = VAL(selection$)
endif
until selection# > 0 and selection# < 101 AND selectionReal = 0
selectionReal = selection#
print "You chose number ",selection#
print
print "Press any key to close the program..."
wait key

[b]
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 3rd Jan 2013 03:04
1. No you cannot use multiple colors on the same line input.
2. No you cannot limit the format of data the user types using the input command.


1. You'd have to write your own input routine to control the displayed output in the manner you want.

2. You can use INT() on the user-submitted value after it's type to get the integer part.

"You're not going crazy. You're going sane in a crazy world!" ~Tick
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 3rd Jan 2013 04:41
Rburke -

1 =


I even tested this with input, so just experiment...

Although, it probably should be mentioned that using this method has apparently performance impacts... have a look at D3Dfunc and Advanced2D for apparently improved text calls... [I am yet to experiment with them]

2 =
Using a tokeniser plugin, or string manipulation techniques like those found in STYX, you indeed can limit what the user can input, just you have to do a little programming... [Sorry at this time I cannot provide any code as such as I am yet to play further with string manipulation...]

Hope this helps...

TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 4th Jan 2013 16:05 Edited at: 4th Jan 2013 16:05
1. With the printc command you can. This is off the top of my head:



(if that doesn't work, try switching the two commands print and printc.)

2. Not with input you can't. You could use the entry buffer however (sorry, also off the top of my head.)



You have to specify where it should print the input on the screen with x and y like so:

myNumber = val( get_entry( 0, 50 ) )

That will print the input text at 0,50.

TheComet

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 21st Jan 2013 09:52
I didn't know about printc.

"You're not going crazy. You're going sane in a crazy world!" ~Tick

Login to post a reply

Server time is: 2024-11-23 13:39:15
Your offset time is: 2024-11-23 13:39:15