If JoyHit(376)...lol
Archives Forums/Blitz3D Bug Reports/If JoyHit(376)...lol
| ||
I'm not sure if this really counts as a bug, but it's a crazy result. Through bad programming, I discovered this. My Joystick does not have 376 buttons, but I use that value as a placeholder for moving the JoyRoll() in a positive direciton and returning True/False. I wrote a function to check for all types of JoyDown(), which even looks for JoyHat(), stick movement, ect. What I forgot to do was write another one in place of JoyHit, and when I passed a variable with 376 to JoyHit, mysteriously, JoyRoll() now returns infinity. All the time! I didn't even know it was possible. Here's a sample to show what I'm talking about. Try the different If statements and see if you have similar results. This could very well be a bug with the Joystick driver and not Blitz, but in either case, I don't find it very comforting that I can mistakenly change the internal return value of JoyRoll(). For me, this only works if my joystick is plugged in and Blitz recognizes it. Graphics 640,480 SetBuffer BackBuffer() While Not KeyDown(1) Cls ;If JoyHit(375) ;Everything is fine here... If JoyHit(376) ;This is where the bug lies. Not really a bug, because a Joystick shouldn't have that many buttons, but fun, nonethless. ;If JoyDown(376) ;Notice that it only comes on JoyHit, not JoyDown... ;If JoyHit(377) ;And, everything is fine here... ;Switch the if states to see the difference that JoyRoll() carries with each one. EndIf Text 0,0,JoyRoll() Flip Wend End EDIT: I should probably include this stuff below: Blitz3D Version 1.100 Window Vista Home Premium 32 Bit OS, AMD Turion 64 X2 TL-50, 1.60Ghz 894 MB Ram (Nothing special about the specs on this laptop) Saitek P2500 Rumble Joystick with the latest drivers they offer Also, I'm using these in my project, but I don't think they're related to this: The Bass Studio Library The Fast Extension Library The Fast Image Library The Fast Text Library Last edited 2011 |
| ||
JoyRoll() now returns infinity I dont have b3d, so could you post what Text 0,0, infinity Looks like |
| ||
If you're talking about running a program like: Text 0,0,infinity WaitKey() All that it does is treat "infinity" like a variable that's not been set and texts 0 in it's place. When I use JoyRoll() with the weird bug-like thing, it just texts the words "Infinity" on the screen. What's weird is that it will always read Inifinity unless I tilt the JoyRoll() all the way to the left, which is -1, and then "Infinity" changes to "NaN", which I know means "Not a Number". I've only ever seen this when dividing by zero or similar situations, but it shouldn't be happening in this spot of code. EDIT: Here's a little more about what I could find out. The first frame that the program generates has a real value for JoyRoll(). It's equal to -0.00274658 every time. The next frame that comes around becomes Infinity. If I store the JoyRoll() to a variable called tempvalue# and then debug log it each loop, the value reads the same as the value for JoyRoll() on the first frame, and in the following frames reads the words Infinity. Last edited 2011 |
| ||
with all 3 Keyboard/Mouse/JoyPad... buttons range from 0 - 255. any higher does give funky results. I think 256 buttons is good enough anyway. |