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 / different input control devices

Author
Message
Nameless
20
Years of Service
User Offline
Joined: 11th Apr 2004
Location: U.S.A.
Posted: 12th Jun 2004 18:45
Recently I have been making (or attempting to make ) simple games that teach the basics of 3D coding. Recently I decided that i wanted to try and write a simple FPS with my gamepad or joystick as the controller. So I attempted the following



But then it could not find the variable "integer". So what am I doing wrong and what do I have to do right to display all of the devices I can use for my game. Thanks

P.S. I;m using DBPRO
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 13th Jun 2004 00:10
Instead of 'Return integer=...' use 'Count=...'.

integer is a reserved word and cannot be used as a variable ... at least it can't if you are running U5.2, and the 'Return' command does not take arguments.

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++ http://www.matrix1.demon.co.uk
Nameless
20
Years of Service
User Offline
Joined: 11th Apr 2004
Location: U.S.A.
Posted: 13th Jun 2004 01:12
So your saying I should try.



Because that did not work . If I did something wrong please change tell me. Thanks
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 13th Jun 2004 01:19
That's strange, because it works for me



When I have my controller plugged in, I get a count of 1 displayed.

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++ http://www.matrix1.demon.co.uk
Nameless
20
Years of Service
User Offline
Joined: 11th Apr 2004
Location: U.S.A.
Posted: 13th Jun 2004 03:02
What the ? It worked when I tried it again. I must have done something wrong the first time.lol.Thanks for the help IanM but I have one more question. when i compiled it it said 1 imput device. Does the keyboard count as an input device, because if it does than my controller might not be working properly. thanks.
the_winch
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 13th Jun 2004 04:57
Quote: "Does the keyboard count as an input device"


No.
This code will show the name of the last device to confirm it's not the keyboard.


can i scream
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 13th Jun 2004 15:12
Neither the keyboard or mouse are counted in that list. Only joysticks, gamepads, steering wheels and other non-standard devices are counted

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++ http://www.matrix1.demon.co.uk
Nameless
20
Years of Service
User Offline
Joined: 11th Apr 2004
Location: U.S.A.
Posted: 18th Jun 2004 00:48
I knows its been a while but I am still struggling to get my game pad working and I did not want to make a new thread. When I try the code that the_winch suggested it comes up as 1 with "game elements game controller" below it. When i used this code



It can not identify the parameters. If this is wrong than what name will DBPro reconize the controller under. Thanks in advance to anyone who wants to give me advice.
the_winch
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 18th Jun 2004 04:02
SET CONTROL DEVICE requires a string so surround the name with quotes.

set control device "set contol device game elements game controller"

It's not a good idea to hardcode the device name like that because when someone else runs the game they won't have a device with that name.

Use something like this to ask the user which controller to use



You would want to add some extra error checking in a game and make it look nicer.

can i scream
Nameless
20
Years of Service
User Offline
Joined: 11th Apr 2004
Location: U.S.A.
Posted: 18th Jun 2004 04:32
So your saying if I use this code



it should work? Because when I tried that it said there was an unknown controller error at line 1. Right now i am not really worried about when others run the game because I am only building this game to prove to myself that I can make a game. thank you for patiently answering my noob questions the_winch I will definitely give you credits in my game.Thanks
the_winch
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 18th Jun 2004 18:33
It should work, you need to make sure the string is exactly the same as the string returned from the checklist. It might just be the name has the first letter of each word in upper case so you would just need to do.
set control device "Game Elements Game Controller"
However if you only have one controler connected to your computer you can use it without having to use SET CONTROL DEVICE.

This code will print the x and y position of the main stick on the gamepad.


can i scream
Nameless
20
Years of Service
User Offline
Joined: 11th Apr 2004
Location: U.S.A.
Posted: 19th Jun 2004 20:59
Alright my controller is working but I have more questions. Is the up on the control pad called upkey or another name? Also on my controller shown here

http://www.hardwareseeker.com/products/axispad/

there are nombered buttons. Under what name will they be reconized ? And one last things do i use the joystick commands to control the analog sticks?Thanks
the_winch
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 19th Jun 2004 21:07
Try this code it shows the results of all the joystick interrogation commands.



As for what is up on the control pad you will just have to test it and see what changes when you press up. I don't know if there is any sort of standard between control pads.

can i scream
Nameless
20
Years of Service
User Offline
Joined: 11th Apr 2004
Location: U.S.A.
Posted: 21st Jun 2004 04:49
Thanks again the_winch that code has worked very well for me and I am now further in my game. That has answered all of my controller questions. thanks again.
Nameless
20
Years of Service
User Offline
Joined: 11th Apr 2004
Location: U.S.A.
Posted: 21st Jun 2004 05:17
Whoops. on second thought there is something that is bugging me and once again i do not want to make a new thread. I am using this code



when i run it Dbpro says the file does not exist. I have moved "New Gun.3DS" it to the projects folder under my current project but it still does not reconize it. So do models have to be in a certain folder for DbPro to reconize them. Sorry I know there is probably a very simple answer and I will feel stupid when I hear it but I have to learn it sometime.thanks.

Login to post a reply

Server time is: 2024-09-22 14:31:12
Your offset time is: 2024-09-22 14:31:12