forums

TNT Basic Forums > Bugs!
Input Device Bug(Or ?)
< Last Thread     Next Thread >
Author
Thread        Post A Reply

12-05-2001 19:16

Posted by:
ERaZer

Click Here to Email ERaZer   Find more posts by ERaZer

I cannot run this code:
if Poll Input(4) = 7
HeroX = HeroX+1
Sprite HeroSprite, HeroX, HeroY, 1
end if
It says like this:
*** Runtime exception caught ***
Line# : 130
Code : if Poll Input(4) = 7
Error : -30422
Why?
I have created a fourth input and I have loaded the input in and everything...

12-05-2001 20:45

Posted by:
Mark Tully

Find more posts by Mark Tully

Not a bug

Sorry, that's a case of unclear documentation.

Poll Input takes element ids from 0 upwards. So your first element in your input list would be polled with "poll input (0)" your second with "poll input (1)" etc. So the fourth would be polled with "poll input (3)".

This may seem confusing but all counting in TNT Basic starts from 0, everything from sprite images to canvases.

Hey, at least we're consistant :)

12-05-2001 21:03

Posted by:
ERaZer

Click Here to Email ERaZer   Find more posts by ERaZer

Okidokey, but that doesn't work...

I'm used to counting starting from zero, but for me it doesn't work! When I for example downloaded the and tested the Outdoor Scrolling Example I needed to add 1 to all input things or otherwise it would quit as soon as it got into the game.

12-06-2001 09:52

Posted by:
Mark Tully

Find more posts by Mark Tully

Opps. Sorry, it's supposed to go from zero, but it's currently going from 1, sorry for the confusion! We'll get that changed, count from 1 for the time being.

Does it still not work for you if you count from 1?

12-06-2001 10:34

Posted by:
ERaZer

Click Here to Email ERaZer   Find more posts by ERaZer

No, its just...

No, its just that I'm having trouble using the D-Pad input device thing...

12-06-2001 18:35

Posted by:
Mark Tully

Find more posts by Mark Tully

Have you seen the input tutorial? That might help.

http://www.tntbasic.com/learn/help_frms/input.html

12-10-2001 14:27

Posted by:
ERaZer

Click Here to Email ERaZer   Find more posts by ERaZer

Uhh...

Well, it doesn't :( Becouse I can't get anything from the d-pad! It just says its an error when I try to use it...

12-10-2001 14:48

Posted by:
John Treece-Birch

Find more posts by John Treece-Birch

Input

I don't suppose it is possible for you to send me the project file that is causing this trouble, can you?

If you can send it to john at tntbasic dot com then I can take a look at it.

Also, what kind of input device are you using with it?

Thanks,
John

12-10-2001 16:11

Posted by:
ERaZer

Click Here to Email ERaZer   Find more posts by ERaZer

No...

No, becouse I scrapped it becouse it didn't work... Well, it was something like this:
If Poll Input(1)=1
'Left
HeroDir=0
else If Poll Input(1)=5
'Right
HeroDir=1
else If Poll Input(1)=3
'Up
HeroDir=2
else If Poll Input(1)=7
'Down
HeroDir=3
end if

01-10-2002 06:36

Posted by:
jn

Find more posts by jn

Is the dpad issue resolved?

I am seeing the identical error code when I try to use a dpad as an input device. I can poll buttons, and x and y axis but when I poll a dpad I get this error.

*** Runtime exception caught ***
Line# : 27
Code : dPad = poll input (1)
Error : -30422

I wrote up a test app which polls 4 buttons and the dpad. If I rem out the poll of the dpad the buttons work fine. Basically the following puts up 5 lines of text on the screen and shows the status of the buttons as either 0 or 1 and should show the dpad as 0 thru 8.

I am using a Gravis Gamepad Pro and am running under OS 9.1

If anyone has gotten a dpad working and can let me know what I am doing wrong, I would sure appreciate it.
Thanks, jn

here is the code

load input 128
activate input

int redBtn = false
int yelBtn = false
int grnBtn = false
int bluBtn = false
int dPad = 0
string myString

while bluBtn = false
set pen colour make colour(0,0,0) 'clear the screen
paint canvas

set pen colour make colour(0,255,0)

redBtn = poll input (2)
yelBtn = poll input (3)
grnBtn = poll input (4)
bluBtn = poll input (5)
dPad = poll input (1)

myString = "redBtn " + as string (redBtn)
draw text 50,50,myString
myString = "yelBtn " + as string (yelBtn)
draw text 50,70,myString
myString = "grnBtn " + as string (grnBtn)
draw text 50,90,myString
myString = "bluBtn " + as string (bluBtn)
draw text 50,110,myString

myString = "D-Pad " + as string (dPad)
draw text 50,150,myString
draw frame
wend

deactivate input

01-10-2002 14:18

Posted by:
Mark Tully

Find more posts by Mark Tully

Fixed in TB 1.01

Yeah sorry about that, the dpad issue was a bug and it has been fixed. TB 1.01 will be posted later today.

Cheers

Mark

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.