Home   Help Search Login Register  

Author Topic: Event Handlers  (Read 703 times)

0 Members and 1 Guest are viewing this topic.

Offline icarus_uk

  • Members
  • *
  • LiarLiarPants Inflame True
    • [furryclan]
Event Handlers
« on: 08 Feb 2003, 15:56:49 »
Got a couple of event handlers, but Ive no clue why they arent working.

Truck2 addEventHandler["getin", "intruck.sqs"];
Truck2 addEventHandler["getout", "outoftruck.sqs"];

Unfortunately whenever I get in or get out of Truck2 I get an error;

intruck|#|.sqs ; Unknown operator
outoftruck|#|.sqs ; Unknown operator

Im stumped, so anyone else got an idea?

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Event Handlers
« Reply #1 on: 08 Feb 2003, 16:13:26 »
u have 2 exec em :P

addEventHandler["getin", "[somthin] exec {intruck.sqs}"];

 ;D

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline icarus_uk

  • Members
  • *
  • LiarLiarPants Inflame True
    • [furryclan]
Re:Event Handlers
« Reply #2 on: 08 Feb 2003, 17:36:26 »
Aha, got rid of the error message.  But now Ive run into a problem with my scripts.

Truck2 addEventHandler["getin", "[this]exec {intruck.sqs}"];
Truck2 addEventHandler["getout", "[this]exec {outoftruck.sqs}"]

Works find.  Both scripts are activeted when the requisite action is performed, however the scripts that are called dont work properly.

intruck.sqs looks like;

(_this select 0) setCaptive true;

exit

And Outoftruck is the same but False.

The idea being that, as long as you are in teh truck, you are a captive, and as soon as you get out the truck, you become a target again.
« Last Edit: 08 Feb 2003, 17:51:56 by [icarus_uk] »

Liquid_Silence

  • Guest
Re:Event Handlers
« Reply #3 on: 09 Feb 2003, 02:24:54 »
Change (this select 0) to ((this select 0) select 0) and it'll work :) or just put this select 0 in the [] left of exec...so {[this select 0] exec "script.sqs"}

Offline icarus_uk

  • Members
  • *
  • LiarLiarPants Inflame True
    • [furryclan]
Re:Event Handlers
« Reply #4 on: 09 Feb 2003, 03:04:23 »
OK it now work with;

Truck2 addEventHandler["getin", "[_this select 0]exec {intruck.sqs}"];

Which is all just fine and dandy.

But now when I get out of the truck, the outoftruck.sqs sript runs;

(_this select 0) setCaptive false;

exit


But my man still remains a captive!  Which he obviously shouldnt do!
« Last Edit: 09 Feb 2003, 03:17:31 by [icarus_uk] »

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Event Handlers
« Reply #5 on: 09 Feb 2003, 03:13:38 »
should b like dat ;)

Truck2 addEventHandler["getout", "[_this select 1]exec {outoftruck.sqs}"]


and script should b

Code: [Select]
(_this select 0) setCaptive false;

exit

nd it wil work  ;) ;D

LCD OUT
« Last Edit: 09 Feb 2003, 10:17:38 by LCD »
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline icarus_uk

  • Members
  • *
  • LiarLiarPants Inflame True
    • [furryclan]
Re:Event Handlers
« Reply #6 on: 09 Feb 2003, 03:16:48 »
Why select 1 ?  The getin part works fine,  its the getting out thats wrong.  And my outoftruck script already looks like yours.
« Last Edit: 09 Feb 2003, 03:25:43 by [icarus_uk] »

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Event Handlers
« Reply #7 on: 09 Feb 2003, 10:16:31 »
da thing is like dat

da eventhandler gives u array

in da getin/out type it gives somin like dat - [truckname,mandatdiddaction] (mebe som oder things but im not sure ;D) - all dis is stored in da _this thingy ;D so wen u do [_this select 1] exec {scriptname.sqs} da man wil b setcaptived false - wen u do [_this select 0] exec {scriptname.sqs} da truck is setcaptived false  :o

btw dere r 2 simpler way 2 do dat if all u wanna do is 2 make him captive  ;D

1) not very simple way -

Code: [Select]
Truck2 addEventHandler["getin", "(_this select 0) setcaptive true"];

and

Code: [Select]
Truck2 addEventHandler["getout", "(_this select 1) setcaptive false"]
somwere ;D prooly in da init of da truck ;) ;D

2) simplest way - u can just make a triger  ;D (but u wil have 2 make lots of trigers 4 MP mision)

TRIGER1 - repedly
condition : maname in truckname
on activition : manname setcaptive true
on deactivision : maname setcaptive false

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline icarus_uk

  • Members
  • *
  • LiarLiarPants Inflame True
    • [furryclan]
Re:Event Handlers
« Reply #8 on: 09 Feb 2003, 13:42:08 »
Oddly enough, its [_This Select 2] that works, not 1 or 0.

And you think Id bother with all this eventhandler kack if I could use a trigger?  The mission is way more complicated that one person in a truck.