Main Menu

No input Command??

Started by Kman1011, December 09, 2006, 12:52:15 PM

Previous topic - Next topic

Kman1011

I am building some demos including a utility for creating animation of characters using mutiple sprites rather than one sprite and series of images to use.

My problem is that there does not seem to be any Input commands that BASIC used in the past. It was used to halt the program and wait for input from the user, such as a string or numeric value.
The string or value entered would be transfered to the variable.

ie
Input "Enter name";a$
print a$


or

Input "Enter number";a
print a


this was the most basic of commands and very surprised not to see it in PB ???

Is there an upcoming patch to rectify this?

I worte some code to do the same thing for now but would like to see it back in future version :-\

kman1011

P.S. I know and saw the examples. There was one called Scancode Input that gave me an error message 27 on line 24
Ahh... Another visitor. Stay awhile....STAY FOREVER!!!...MWA-HA-HA-HA

stef

#1
To the scancode-input example

in line 24 and line 65

change

InputColour MyInput, RndRGB()

to

InputColours ( MyInput, RndRGB(),RndRGB())
or something like InputColours ( MyInput, RGB(255,0,0),0)


PS.:
(not that important)
with
circleC x#,Stars(lp).y#,2,1,Stars(lp).colour
instead of
DotC x#,Stars(lp).y#,Stars(lp).colour
in line 123
you can see the stars better :)
really nice




kevin


   The example "Scancode_Input"  is obsolete.  The equivalent example is the "Input" example.     I've updated the documentation to include Input library, plus added a StaticInput wrapper. 


QuoteIt was used to halt the program and wait for input from the user, such as a string or numeric value.
The string or value entered would be transfered to the variable. 

    There's your answer, apart from the obviously syntax differences,  _Halting_ executing in the last thing people want in a game!   


QuoteI worte some code to do the same thing for now but would like to see it back in future version

   Unlikely!

Mick Berg

Can the  new Input routine be used with numbers/values? As opposed to strings? As far as I can see (and I know I'm usually wrong) it only works with strings.
Thanks,
Mick Berg.

Kman1011

Actually I wrote two subroutines.

One for entering numeric values and another for entering strings

I used the 'VAL()' command.

;~~~~~~~~~~~~~~~~~~~ENTER~~~NUMBER~~VALUES~~~~~~~~~~~~~~~~~~~~~~~
EnterNumval:
CursorMargin 0
char=0:num$=""
Repeat
Cls 0
SetCursor 0,120
Print question$
KEY$(char)=Inkey$()
If key$(char)<>""
   If ScanCode()=14;Check if backspace key is hit
    char=char-1:If char<0 Then char=0
    BoxC char*8,133,char*8+8,136+16,1,0
      If num$<>"" Then num$=TrimRight$(num$,key$(char))
      WaitNoKey
      Else
   SetCursor char*8,133
num$=num$+key$(char)
Inc char
EndIf
EndIf
Print num$
Sync
Until EnterKey()=True
BoxC 300,120,450,144,1,0
n#=Val(num$)
Sync
Return


Its's very rough. I need to intall a cursor or something..
Ahh... Another visitor. Stay awhile....STAY FOREVER!!!...MWA-HA-HA-HA

kevin

  All input is returned in String form.   You can convert the string to a value using the VAL() functions.



   MyString$="123.456"
   
; decode a string formated as integer
   MyIntValue=Val(MyString$)

; decode a string formated as float
   MyFloatValue#=Val#(MyString$)
   
   print MyIntValue
   print MyFloatValue#
   
sync
waitkey




Mick Berg

#6
I tried using VAL to convert to a value, but couldn't get it to work, but now as you say it can be done, I will persevere!
Thanks,
Mick Berg.
EDIT: Seems you can't have any text in the third paramater of NewInput() or VAL won't work. I put in a "" and it worked, ie NewInput(20,250,"").

Kman1011

Just a footnote...

There a function called 'FLUSKKEYS' and I use it whenever I get unwanted characters or this routine is not working properly. I got so frustrated writing this code once and i came across this function and used it and voila!!
It cleared things up for me.

Just thought I would bring this to the attention of unaware programmers.
;)
Ahh... Another visitor. Stay awhile....STAY FOREVER!!!...MWA-HA-HA-HA