Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (7th_zorro, Ayumi, AndrewAMD, Quad), 1,014 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
joystick stubborn #406409
08/19/12 19:09
08/19/12 19:09
Joined: Sep 2003
Posts: 733
Whitefish, Montana
JazzDude Offline OP
User
JazzDude  Offline OP
User

Joined: Sep 2003
Posts: 733
Whitefish, Montana
Using this code, the mouse works but the joystick doesn't

while (mouse_left == on)||(joy_1 == on)
{
fire_bullets();
boost_anim();
wait(-0.2);
}

The joystick tests okay.

Re: joystick stubborn [Re: JazzDude] #406412
08/19/12 19:26
08/19/12 19:26
Joined: Jul 2004
Posts: 785
Serbia
Iglarion Offline
User
Iglarion  Offline
User

Joined: Jul 2004
Posts: 785
Serbia
Try this:

while(joy_1 || mouse_left == on){
beep();
wait(1);
}




IGRAVISION Page - www.igravision.com
RPG project - The Battle For Forgol 92.75%
Re: joystick stubborn [Re: Iglarion] #406413
08/19/12 19:51
08/19/12 19:51
Joined: Sep 2003
Posts: 733
Whitefish, Montana
JazzDude Offline OP
User
JazzDude  Offline OP
User

Joined: Sep 2003
Posts: 733
Whitefish, Montana
Thanks, but it still doesn't work.

Re: joystick stubborn [Re: JazzDude] #406415
08/19/12 20:00
08/19/12 20:00
Joined: Jul 2004
Posts: 785
Serbia
Iglarion Offline
User
Iglarion  Offline
User

Joined: Jul 2004
Posts: 785
Serbia
I just tested and work well, of course you need put this in while loop. You not hear the beep when you prees one of this buttons?


IGRAVISION Page - www.igravision.com
RPG project - The Battle For Forgol 92.75%
Re: joystick stubborn [Re: Iglarion] #406416
08/19/12 20:09
08/19/12 20:09
Joined: Sep 2003
Posts: 733
Whitefish, Montana
JazzDude Offline OP
User
JazzDude  Offline OP
User

Joined: Sep 2003
Posts: 733
Whitefish, Montana
It is in a while loop, and yes, it works with the mouse. The joystick pan and tilt work. But I'm not getting anything from the fire button or any other button. It's a USB joystick and it works okay on flight sims.

There's not much info in the manual or forum search to help.

Re: joystick stubborn [Re: JazzDude] #406418
08/19/12 20:36
08/19/12 20:36
Joined: Jul 2004
Posts: 785
Serbia
Iglarion Offline
User
Iglarion  Offline
User

Joined: Jul 2004
Posts: 785
Serbia
Hmm this is strange... if you say your joystick buttons works in other games and windows test, then really i do not know why wont work in 3dgs, because it should be so simple, and it is nice explained in the manual.


IGRAVISION Page - www.igravision.com
RPG project - The Battle For Forgol 92.75%
Re: joystick stubborn [Re: Iglarion] #406423
08/19/12 21:14
08/19/12 21:14
Joined: Jul 2002
Posts: 3,208
Germany
Error014 Offline
Expert
Error014  Offline
Expert

Joined: Jul 2002
Posts: 3,208
Germany
Hey,

let's try if we can at least find what causes this.

Can you check what value

Code:
num_joysticks



has?

An easy way to do so would be to add this function to your game, then press "j" and let us know what number appears:

Code:
function numjoysticktest_startup() {
while(!key_j) wait(1);
error(str_for_num(NULL,num_joysticks));
}



This should give us a hint whether or not that joystick is getting recognized at all.


Another possible thing to check: Perhaps it's not registered as the first joystick, or it's not the first button. To check for that, consider adding this function:

Code:
function numjoysticktest_startup() {
while(!key_k) wait(1);
while(key_k) wait(1);
error("Ready!");
while(key_any) wait(1);
while(key_any==0) wait(1);
error(str_for_num(NULL,key_lastpressed));
}



If you add that function to your code, then hit [K], a prompt reading "Ready!" will appear. Click "OK", then (before hitting any other key) hit your joystick button.
It will (if it recognizes the joystick, at least) report the scancode of whichever key was pressed. You can then check the manual to see what key that is, or report to us the number and we can check that together.


Perhaps this post will get me points for originality at least.

Check out Dungeon Deities! It's amazing and will make you happy, successful and almost certainly more attractive! It might be true!
Re: joystick stubborn [Re: Error014] #406427
08/19/12 21:44
08/19/12 21:44
Joined: Sep 2003
Posts: 733
Whitefish, Montana
JazzDude Offline OP
User
JazzDude  Offline OP
User

Joined: Sep 2003
Posts: 733
Whitefish, Montana
Sounds good. I'm on it.

Re: joystick stubborn [Re: JazzDude] #406429
08/19/12 21:58
08/19/12 21:58
Joined: Sep 2003
Posts: 733
Whitefish, Montana
JazzDude Offline OP
User
JazzDude  Offline OP
User

Joined: Sep 2003
Posts: 733
Whitefish, Montana
First test reported 1
Second 256 Joy_1

...and the mystery grows deeper.

Re: joystick stubborn [Re: JazzDude] #406430
08/19/12 22:20
08/19/12 22:20
Joined: Jul 2002
Posts: 3,208
Germany
Error014 Offline
Expert
Error014  Offline
Expert

Joined: Jul 2002
Posts: 3,208
Germany
Ah, a challenge!
Well, let's check that value then!

Try adding this function to your script and let us know what numbers appear on the screen!

Code:
function alovelytestofalovelykey_startup() {
while(1) {
draw_text(str_for_num(NULL,joy_1),1,1,vector(255,255,255));
draw_text(str_for_num(NULL,key_pressed(256)),1,20,vector(255,255,255));
wait(1);
}
}



It should - in theory - display "0" and "0" if you don't press the joystick button, and "1", "1" otherwise.


Perhaps this post will get me points for originality at least.

Check out Dungeon Deities! It's amazing and will make you happy, successful and almost certainly more attractive! It might be true!
Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1