Results 1 to 8 of 8

Thread: How to parse a parameter of a LONG type?

  1. #1

    How to parse a parameter of a LONG type?

    Hi Eros,

    I have this function:

    [code=thinbasic] '----------------------------------------------------------------------------
    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

    [/code]

    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?

  2. #2

    Re: How to parse a parameter of a LONG type?

    I changed it to
    [code=thinbasic] If thinBasic_CheckOpenParens() Then
    thinBasic_ParseNumber (ByVal hInstance)
    If thinBasic_CheckCloseParens() Then
    [/code]

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

  3. #3
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10

    Re: How to parse a parameter of a LONG type?

    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

    [code=thinbasic]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[/code]

    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

    [code=thinbasic]
    eInstance = thinBasic_Parse1NumberAndParens
    [/code]
    It will automatically check if parens or not. It is also faster.

    Ciao
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  4. #4

    Re: How to parse a parameter of a LONG type?

    Thanks and No problem Eros.

  5. #5
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404

    Re: How to parse a parameter of a LONG type?

    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?
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  6. #6

    Re: How to parse a parameter of a LONG type?

    Wait Kent till I got effects in. First it will be just axxis and buttons.

  7. #7
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732

    Re: How to parse a parameter of a LONG type?

    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 . Well, things are changing fast
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  8. #8
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404

    Re: How to parse a parameter of a LONG type?

    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!!
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

Similar Threads

  1. How to parse an array or a UDT parameter?
    By Michael Hartlef in forum Module SDK (Power Basic version)
    Replies: 11
    Last Post: 14-06-2009, 21:47

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •