Home   Help Search Login Register  

Author Topic: turnsignal  (Read 2406 times)

0 Members and 1 Guest are viewing this topic.

Offline coldfuse

  • Members
  • *
turnsignal
« on: 12 Mar 2009, 09:07:15 »
So I already know how to make the animation for the light, but what my question is i want a work turn signal so that when i press my greater than or less then keys i want it to run the scripts for the animations. 

Some Superior being told me an add action would work but doesn't this only display an action in a dialog?

Offline Ext3rmin4tor

  • Members
  • *
Re: turnsignal
« Reply #1 on: 12 Mar 2009, 10:59:49 »
I've never done it, but I think it will be possible to add a shortcut key to the action, since in Warfare maps you can access the command menu by pressing the "T" key. If you look in the parameters of the command, you'll see the last value is called "shortcut" (even if it is not explained what that means), you can try and see if it works.
How can you shoot women and children?
Easy! Ya' just don't lead'em so much! Ain't war hell?!!

Offline coldfuse

  • Members
  • *
Re: turnsignal
« Reply #2 on: 12 Mar 2009, 11:36:34 »
yeah, didn't think about that but if some one has any other ideas let know.

Offline Deadfast

  • Members
  • *
Re: turnsignal
« Reply #3 on: 12 Mar 2009, 14:00:48 »
You can use displaySetEventHandler with KeyDown to "sniff" the pressed keys.

There are some examples on the page, let me know if you need help with them :)
« Last Edit: 12 Mar 2009, 14:02:20 by Deadfast »

Offline coldfuse

  • Members
  • *
Re: turnsignal
« Reply #4 on: 12 Mar 2009, 22:24:22 »
yeah that makes sense to me...
But won't this  stay on after i hit that key, how would i go about making it disable as soon as i left off that key.
 
« Last Edit: 13 Mar 2009, 10:06:02 by coldfuse »

Offline Deadfast

  • Members
  • *
Re: turnsignal
« Reply #5 on: 13 Mar 2009, 18:51:49 »
You could set the executed command to nothing:
Code: [Select]
displaySetEventHandler ["KeyDown", ""]

Offline coldfuse

  • Members
  • *
Re: turnsignal
« Reply #6 on: 14 Mar 2009, 08:21:51 »
 :good: ill let you see the out come here in a few days.

Offline Deadfast

  • Members
  • *
Re: turnsignal
« Reply #7 on: 14 Mar 2009, 10:20:11 »
Good luck :)


Nice idea BTW ;)

Offline coldfuse

  • Members
  • *
Re: turnsignal
« Reply #8 on: 14 Mar 2009, 10:37:18 »
Quote
Error context isplaySetEventHandler ["KeyDown",""];
File p:\suburban_police\config.cpp, line 408: '/CfgVehicles/suburban_police/UserActions/flasher._display': 'd' encountered instead of '='

the config http://pastebin.com/f582150e3

do you have any idea's :confused:
« Last Edit: 14 Mar 2009, 10:42:53 by coldfuse »

Offline DeanosBeano

  • Addons Depot Staff
  • *****
  • SirDeanosbeano bstowed on me by sui ;)
    • Fraghaus
Re: turnsignal
« Reply #9 on: 14 Mar 2009, 11:26:15 »
 hey coldfuse,
 now this advise comes with some unkowns, because i believe these handlers are like eventhandlers and can become disabled overridden , i believe someone made a comparable XEH for these ttypes , maybe it was sole, here on these forums.?
 what i have always done is use Lethals key handlers from his afterburner script and changed the key codes and what the keypress does.

heres a quick excerpt maybe you can adapt without much problems key 42 is left shift all other codes are available on the wiki i believe.

Code: [Select]

_this setvariable ["_on",false];
finddisplay(46) displayseteventhandler ["Keydown","if ((_this select 1) == 42) then {(vehicle player) setVariable [""_on"",true]}"];
finddisplay(46) displayseteventhandler ["Keyup","if ((_this select 1) == 42) then {(vehicle player) setVariable [""_on"",false]}"];

while {true} do {
if ((isengineon _this) and (_this getvariable "_on"))then

        place your animation lines here and it will need closing of properly, also this is obviously just one key.




sorry my advise is not complete but i am sure it will help you a little :).

 now i have awoke and seen your pastebin link , maybe you just need extra quotes on  ""KeyDown""
« Last Edit: 14 Mar 2009, 11:36:59 by DeanosBeano »
I love ofp

Offline i0n0s

  • Former Staff
  • ****
Re: turnsignal
« Reply #10 on: 14 Mar 2009, 12:18:30 »
hey coldfuse,
 now this advise comes with some unkowns, because i believe these handlers are like eventhandlers and can become disabled overridden , i believe someone made a comparable XEH for these ttypes , maybe it was sole, here on these forums.?
S_Hole made them, SPON_CORE also use them if available.

Offline coldfuse

  • Members
  • *
Re: turnsignal
« Reply #11 on: 14 Mar 2009, 12:42:12 »
deano your way seems pretty complicated...As for the animations im calling some light efects in from a script and where exactly would i put this under my user actions?
sorry i havent gone to sleep yet.
thank you for the suggestions could you explain the first one a bit more tho.

also i tried the second suggestion.

Code: [Select]
Error context isplaySetEventHandler [""KeyDown"",""""];
File p:\suburban_police\config.cpp, line 444: '/CfgVehicles/suburban_police/UserActions/flasher._display': 'd' encountered instead of '='
Config : some input after EndOfFile.
Error 3 while parsing
Error in config p:\suburban_police\config.cpp
W:\c\El\ParamFile\paramFile.cpp(736) : Class destroyed, but still locked

Offline DeanosBeano

  • Addons Depot Staff
  • *****
  • SirDeanosbeano bstowed on me by sui ;)
    • Fraghaus
Re: turnsignal
« Reply #12 on: 14 Mar 2009, 20:45:03 »
 wellfirstly , if you are gonna use displayeventhandlers , i would use sponcore too ,this way you will get more support ,because spooner is still around i havent seen much of s_hole  for a while.
 second if you go the way of lethals ,you wont need to define useractions you simply create an initeventhandler (use XEH) and a script will wait till the key is pressed before it animates the face ( i presume your animating a coloured face rather than setobjecting) and animate it back when another key is pressed or you could get really techichal for the off switch by monitoring the angle of the wheel so it auto turns off lol.

 to test get hold of lethals script and just change it to suit your needs ,
I love ofp