Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, Ayumi), 1,405 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
help with adding keys... #312693
02/25/10 23:47
02/25/10 23:47
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
Blink Offline OP

Expert
Blink  Offline OP

Expert

Joined: Jan 2006
Posts: 2,157
Connecticut, USA
ok, I have a flashlight script that uses two button to trigger it. the f key on a pc keyboard and the x-box 360 controller button joy_5. it works fine.
Code:
while (energy > 0 && key_f + joy_5== 1)


I want to do the same for other codes i have with no success. i want to use the keyboard and the the 360 controller to trigger these other things as well. when i try to add the other keys, I get errors. what can i do? i want to have the option to use either the mouse and keyboard or the 360 controller buttons.


My Famous Quotes: "Hip hop is like a virus, infecting everyone and everything around it. Every form of media has some way,shape or form, assimilated hip hop into it." It has also mutated into other strains like, trip hop, house, rap, gangster, and conscious forms. Once you are infected with it, its with you for life."
Re: help with adding keys... [Re: Blink] #312712
02/26/10 01:18
02/26/10 01:18
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
var input[2];
#define key_jump 0
#define key_shoot 1

function handle_input() {
if(use_xbox) {
input[key_jump] = scan code from joy_5, see "key mapping";
input[key_shoot] ...
}
else {
set input[] key_board scan codes
}

Then in your functions:
if(key_pressed(input[key_shoot]) && ...) { }


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: help with adding keys... [Re: Superku] #312718
02/26/10 03:03
02/26/10 03:03
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
Blink Offline OP

Expert
Blink  Offline OP

Expert

Joined: Jan 2006
Posts: 2,157
Connecticut, USA
thanks for the response superku, seems like a lot of work. cant i simply just add something like my example to the existing code? i just dont want to ruin the code i have by adding too much. the code i am trying to change works perfectly when i switch and use either mouse/keyboard combo or 480, but gives me errors when i add both to the script. its either on_k or joy_10, as an example. why doesnt this work?

on_mouse_right && joy_10=gravitation_gun;

Last edited by Blink; 02/26/10 03:09.

My Famous Quotes: "Hip hop is like a virus, infecting everyone and everything around it. Every form of media has some way,shape or form, assimilated hip hop into it." It has also mutated into other strains like, trip hop, house, rap, gangster, and conscious forms. Once you are infected with it, its with you for life."
Re: help with adding keys... [Re: Blink] #312794
02/26/10 14:21
02/26/10 14:21
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
This "on_mouse_right && joy_10=gravitation_gun;" is wrong syntax.
Try
on_mouse_right =gravitation_gun;
on_joy_10=gravitation_gun;

Last edited by Superku; 02/26/10 14:22.

"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: help with adding keys... [Re: Superku] #312871
02/26/10 17:13
02/26/10 17:13
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
Blink Offline OP

Expert
Blink  Offline OP

Expert

Joined: Jan 2006
Posts: 2,157
Connecticut, USA
i actually tried that and i got an error on joy_10.
thats why i need help.


My Famous Quotes: "Hip hop is like a virus, infecting everyone and everything around it. Every form of media has some way,shape or form, assimilated hip hop into it." It has also mutated into other strains like, trip hop, house, rap, gangster, and conscious forms. Once you are infected with it, its with you for life."
Re: help with adding keys... [Re: Blink] #312876
02/26/10 17:17
02/26/10 17:17
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
Blink Offline OP

Expert
Blink  Offline OP

Expert

Joined: Jan 2006
Posts: 2,157
Connecticut, USA
truthfully, i dont mind using the graviton gun as is, is my other weapons. i want them to be able t be used with either te keyboard or360 buttons.

update: ok, I was able to add a key to one weapon script, let's see if I can figure the rest out. for some reason it didnt work before. maybe i did something wrong.

Last edited by Blink; 02/26/10 17:35.

My Famous Quotes: "Hip hop is like a virus, infecting everyone and everything around it. Every form of media has some way,shape or form, assimilated hip hop into it." It has also mutated into other strains like, trip hop, house, rap, gangster, and conscious forms. Once you are infected with it, its with you for life."
Re: help with adding keys... [Re: Blink] #312881
02/26/10 17:47
02/26/10 17:47
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
Blink Offline OP

Expert
Blink  Offline OP

Expert

Joined: Jan 2006
Posts: 2,157
Connecticut, USA
ok, this is at the end of my script on one of the weapons. i tried adding a key to it and i got a "too many variables" error.

on_joy3 = create_boomerang;

I changed it to :
on_joy3 + on_b = create_boomerang;
and tried:
on_joy3 + on_key_b = create_boomerang;
got errors.



Last edited by Blink; 02/26/10 17:51.

My Famous Quotes: "Hip hop is like a virus, infecting everyone and everything around it. Every form of media has some way,shape or form, assimilated hip hop into it." It has also mutated into other strains like, trip hop, house, rap, gangster, and conscious forms. Once you are infected with it, its with you for life."
Re: help with adding keys... [Re: Blink] #312896
02/26/10 18:55
02/26/10 18:55
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
as Superku say: don`t use && or + in on_x.

Use only one key or joy for one on_xxx

on_joy3 = create_boomerang;
on_b = create_boomerang;

Edit: joy_10 is wrong, use joy10 (USE THE MANUAL !!!)

Last edited by Widi; 02/26/10 18:57.
Re: help with adding keys... [Re: Widi] #312911
02/26/10 21:59
02/26/10 21:59
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
Blink Offline OP

Expert
Blink  Offline OP

Expert

Joined: Jan 2006
Posts: 2,157
Connecticut, USA
I know Widi, I am not a newb, I just forgot how to do some things, yelling USE THE MANUAL!!! doesnt really help..


My Famous Quotes: "Hip hop is like a virus, infecting everyone and everything around it. Every form of media has some way,shape or form, assimilated hip hop into it." It has also mutated into other strains like, trip hop, house, rap, gangster, and conscious forms. Once you are infected with it, its with you for life."
Re: help with adding keys... [Re: Blink] #313001
02/27/10 14:21
02/27/10 14:21
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Problem solved?


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
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