Home   Help Search Login Register  

Author Topic: EH  (Read 642 times)

0 Members and 1 Guest are viewing this topic.

Skanderborgvej

  • Guest
EH
« on: 06 Aug 2003, 00:11:11 »
I tried the following but it didnt worked (I'm not an expert in EH but, this can't be so difficult, is it....):

init: dude AddEventHandler ["fired",{[smokeshell] exec "fire.sqs"}]

script (fire.sqs):

_ammo = _this select 0

? _ammo = "smokeshell": hint "it worked"


BUT it doesn't work... ??? :-\ (script is key, I think, but I'm not comfortable with that eventhandler...)
Someone a solution?

I tried if "dude" throwed a smokeshell then it executed the script

grTZ


Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:EH
« Reply #1 on: 06 Aug 2003, 00:41:42 »
just simple eror ;)

shud b

_ammo = _this select 1

? _ammo = "smokeshell": hint "it worked"

;D ;) :P

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

Skanderborgvej

  • Guest
Re:EH
« Reply #2 on: 06 Aug 2003, 00:58:13 »
mmmmmm  ::) ,

Doesn't seems to work (it may be me but...  )

GrTz  ;)

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:EH
« Reply #3 on: 06 Aug 2003, 01:03:53 »
k it seems 2 b ma wrong  :-X

try doin it

_ammo = _this select 4

nd if it wont work try 2 or 3

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

Skanderborgvej

  • Guest
Re:EH
« Reply #4 on: 06 Aug 2003, 01:17:10 »
errmmm  

Nope, When using it with 2&3 I get this "ZERO  :o DEVISOR"-error


Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:EH
« Reply #5 on: 06 Aug 2003, 01:20:06 »
and wat about 4 ?

ohh i know wats ur prob ::) (just noticed - i prooly drink 2 much :P just didnt read ur Q completly ;))

u shud change da event handler 2 b

init: dude AddEventHandler ["fired",{_this exec "fire.sqs"}]

nd now use 4 or 1

im sure :P

LCD OUT

(i know dat from b4 ::) i just used da above 2 posts 2 boost mapost count ;))
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:EH
« Reply #6 on: 06 Aug 2003, 02:42:53 »
There are a couple of ways to fix your script... the first involves putting smokeshell in quotes:

init: dude AddEventHandler ["fired",{[ "smokeshell"[/u] ] exec "fire.sqs"}]

Also, add another = sign ;)

? _ammo == "smokeshell": hint "it worked"


It wasn't working because _ammo was equal to: smokeshell
Rather than "smokeshell", and because you need two ='s to compare things, rather than one ;)

The other way is to detected the actual ammo the unit is firing, rather than just putting "smokeshell". LCD is on the right track... you'd be looking at something like this:

init: dude AddEventHandler ["fired",{[_this select x ] exec "fire.sqs"}]

ammo = _this select 0

? _ammo == "smokeshell": hint "it worked"

I haven't got access to my ComRef at the moment, so I can't tell you what number exactly x should be. However with smokeshells the magazine, projectile and ammo name are all "smokeshell". So anything between about 2 and 4 should do the trick ;)

[size=0.5]Edit: Oops... yabb doesn't like square brackets getting together...[/size]
« Last Edit: 06 Aug 2003, 02:46:15 by Sui »

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:EH
« Reply #7 on: 06 Aug 2003, 02:44:52 »
before you use what Sui wrote, let him edit his post to correct his bold insertions as '' is not needed in the scripts  ;)
Proud Member of the Volunteer Commando Battalion

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:EH
« Reply #8 on: 06 Aug 2003, 02:49:47 »
Hehe... yeah this version of Yabb doesn't like text change statements beside square brackets... fixed now :)

Offline Igor Drukov

  • Contributing Member
  • **
  • Conscientious Subjector
Re:EH
« Reply #9 on: 06 Aug 2003, 03:22:38 »
Mmmmh, no need to write a script for this, Vlaamse :

I don't know exactly what you want to do, but to do what you want in your first post, a line like this in the init field :

Code: [Select]
this addEventHandler ["fired",{if (_this select 4=="smokeshell") then {hint "yeh !"}}]
will do the trick.

More details here.  ;)
« Last Edit: 06 Aug 2003, 03:23:02 by Igor Drukov »

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:EH
« Reply #10 on: 06 Aug 2003, 10:00:35 »
so wats da prob w/ ma last post dat u all rushed here 2 help ? i just got it workin :P

Quote
init: dude AddEventHandler ["fired",{_this exec "fire.sqs"}]

nd now use 4 or 1

::)

it just was late night den so it took me som time 2 notice  :-X

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

Skanderborgvej

  • Guest
Re:EH
« Reply #11 on: 06 Aug 2003, 10:30:40 »
TOP

@ LCD : boost your post counts => LOL....  ;D (I think your loosing some of your skills matey...   ::) )

@ SUI & IGOR : They both worked ( the "smokeshell" and == thingy was it)

@ ALL: Thanks soldiers, another happy costumer  ;D
 
Grtz  ;) Vlaamse Leeuw