PDA

View Full Version : How to parse a parameter of a LONG type?



Michael Hartlef
27-02-2007, 20:09
Hi Eros,

I have this function:


'----------------------------------------------------------------------------
Function TBDI_Init() As Long
' Initialize DirectInput.
' Usage: retval = TBDI_Init( hInstance AS LONG)
'----------------------------------------------------------------------------
Local hInstance As Long

If thinBasic_CheckOpenParens() Then
thinBasic_VariableParseAndGetInfo hInstance
If thinBasic_CheckCloseParens() Then



The powerbasic compiler complains about type mismatch with the line that parses the hinstance parameter. So my question is, which parse function do I have to use?

Michael Hartlef
27-02-2007, 20:25
I changed it to

If thinBasic_CheckOpenParens() Then
thinBasic_ParseNumber (ByVal hInstance)
If thinBasic_CheckCloseParens() Then


now it compiles but I'm not sure if this is the right way to do it.

ErosOlmi
27-02-2007, 20:33
Mike,

all numeric interface functions work with EXT data type.
So ou need to declare an EXT variable, parse it and than assign to a LONG or whatever variable.
Examle


DIM eInstance as ext
dim lInstance as long
...
If thinBasic_CheckOpenParens() Then
thinBasic_ParseNumber eInstaìnce
If thinBasic_CheckCloseParens() Then
lInstance = eInstance
'...
'...do what you need here
'...
end if
end if

Many times the assignement is not necessary if using API functions because most of the time numeric values are passed BYVAL

Sorry, very busy day at work. I will have more time when back home this night. Feel free to send me any mail or post any message.
If you have to parse just one variable you can also use thinBasic_Parse1NumberAndParens function



eInstance = thinBasic_Parse1NumberAndParens

It will automatically check if parens or not. It is also faster.

Ciao
Eros

Michael Hartlef
27-02-2007, 20:36
Thanks and No problem Eros.

kryton9
27-02-2007, 21:45
I think it is fast approaching time I go buy a rumble game pad, the game device input is coming alive!!
Which comes to any recommendations? I used to have a cheap generic gamepad, I know you can buy an Xbox controller for the computer, would that be better, does that have rumble? Any other ones you guys used that you liked?

Michael Hartlef
27-02-2007, 21:51
Wait Kent till I got effects in. First it will be just axxis and buttons.

Petr Schreiber
27-02-2007, 21:54
It is great Mike is working on it now!

I can't wait for first release...


Bye,
Petr

P.S. kryton, I have no idea what do you mean by generic gamepad :) I have all the controlers at home by Logitech ( good / bad ? ) and in my opinion it is very good and durable stuff. But I had no oportunity to try controlers from othere designers.
No one of the devices has force feedback, I thought not so many games support it so I avoided it :D. Well, things are changing fast :)

kryton9
27-02-2007, 21:59
It would be neat to have a rumble only when our ship is hit, this way you know you are getting damage and maybe can help to learn how to avoid enemy attack blasts better. It would also be neat when you dock to get that connection feel to the station or other ships. Or picking up a pick up.

I have a logitech joystick that I use now, but I think for this cool game a rumble game pad might be more of the perfect input device :)

No rush Mike, I just wanted to say how happy I am you are working on this making such progress!!