Home   Help Search Login Register  

Author Topic: Syntax (yeah, i KNow!)  (Read 2110 times)

0 Members and 1 Guest are viewing this topic.

funkster

  • Guest
Syntax (yeah, i KNow!)
« on: 11 Sep 2005, 04:12:12 »
Hi all,
Just a quick question. What am I doing wrong here?

Code: [Select]
@ (unitReady WAfour) ((WAfour doFire Emtwelve), (setAccTime 0.1))
Thank you muchly!

-------------------------------------------------------------------------------------------
EDIT: O, I think I need square brackets right? Im off to try this.....
« Last Edit: 11 Sep 2005, 04:12:57 by funkster »

Offline Blanco

  • Former Staff
  • ****
Re:Syntax (yeah, i KNow!)
« Reply #1 on: 11 Sep 2005, 04:40:54 »
Hi, use this

Code: [Select]
@unitReady WAfour
WAfour doFire Emtwelve
setAccTime 0.1





Search or search or search before you ask.

funkster

  • Guest
Re:Syntax (yeah, i KNow!)
« Reply #2 on: 11 Sep 2005, 09:36:54 »
LOL, thanks. Thats so simple, for some reason, i thougt it all had to be on the same line...

I am eternally indebted to you my good freind....


funkster

  • Guest
Unit Fired..?
« Reply #3 on: 12 Sep 2005, 00:29:46 »
Ive unsolved this thread cause I have another issue (not just syntax).

When I use the line :

Code: [Select]
@unitReady WAfour
WAfour doFire Emtwelve
setAccTime 0.1

It is in a cutscene, when the tank is ready to fire, it goes into super slow mo, and fires.

This works, however, the unit fires maybe around, I dont know, a second, sometimes longer after commanded to, hence ruining the whole scene.

So, what I wish I could do is addEventhandler ["fired", go into slow mo] !

But there is no such event handler, nor is there a unitFired command which I could use.

I cant think of a way to tell the script to execute certain commands instantly after a selected unit has fired....Can anyone tell me a way to do this?

Thanks.

Kyle Sarnik

  • Guest
Re:Unit Fired..?
« Reply #4 on: 12 Sep 2005, 01:48:29 »
Ive unsolved this thread cause I have another issue (not just syntax).

When I use the line :

Code: [Select]
@unitReady WAfour
WAfour doFire Emtwelve
setAccTime 0.1

It is in a cutscene, when the tank is ready to fire, it goes into super slow mo, and fires.

This works, however, the unit fires maybe around, I dont know, a second, sometimes longer after commanded to, hence ruining the whole scene.

So, what I wish I could do is addEventhandler ["fired", go into slow mo] !

But there is no such event handler, nor is there a unitFired command which I could use.

I cant think of a way to tell the script to execute certain commands instantly after a selected unit has fired....Can anyone tell me a way to do this?

Thanks.

Well, in this situation you would probably want to use a fired eventhandler:

Code: [Select]
WAfour addeventhandler ["fired",{_this exec "fired.sqs"}]
fired.sqs
Code: [Select]
_unit = _this select 0
_mags = magazines _unit

{_unit removemagazine _X} foreach _mags
_unit removeeventhandler ["fired",0]
exit

funkster

  • Guest
Re:Syntax (yeah, i KNow!)
« Reply #5 on: 12 Sep 2005, 05:57:04 »
O ok, thanks.
So there is a 'fired' EH after all huh? Its not listed in the EH tut....

Thats good to know,  but what is the code you have given me for - fired.sqs?

why do i want to remove magazines? Wont OFP remove each magazine automatically every time a unit fires?

Cheers,

funkster

Kyle Sarnik

  • Guest
Re:Syntax (yeah, i KNow!)
« Reply #6 on: 12 Sep 2005, 20:40:39 »
O ok, thanks.
So there is a 'fired' EH after all huh? Its not listed in the EH tut....

Thats good to know,  but what is the code you have given me for - fired.sqs?

why do i want to remove magazines? Wont OFP remove each magazine automatically every time a unit fires?

Cheers,

funkster


Wow, what kind of tut left out the fired EH? Its probably  the most important one of all!  :o

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Syntax (yeah, i KNow!)
« Reply #7 on: 13 Sep 2005, 03:30:17 »
the code he gave you will stop them from firing a sencond time, which is what you asked for ;)

funkster

  • Guest
Re:Syntax (yeah, i KNow!)
« Reply #8 on: 13 Sep 2005, 05:54:24 »
Nononono, you have misundersood me.

What I wanted was for the scene to go into slow mo, as the tank fires, then go back to normal speed.

What happens currently, is that it goes into slow mo, and simultaneously execs doFire, however, you can wait for around 10 seconds or more (1+ seconds in real time) before the tank fires. This ruins the cinematic effect, I want the script only to go into slow mo AS the tank fires, rather than before.

Using Kyle's suggestions, I have implemented an event handler to detect when the tank fires;

Code: [Select]
WAfour addeventhandler ["fired",{_this exec "fired.sqs"}]
However, I have created the following code as "fired.sqs"

Code: [Select]
~ 0.05

setAccTime 0.1
WAfour removeEventHandler ["fired", 0]

~ 0.8

setAccTime 1

EXIT

So, in theory, only when the tank has "fired", does "fired.sqs" get called (which then implements slow mo for ~ 0.8 seconds).

In reality, I find that often, what may happen is it can go into super slow mo for around 20 seconds, the tank hasn't fired yet, and only when the tank has fired  (after 20 secs or more )does the script exit and return to normal time.
What does this suggest? - That the "Fired" EH can be true, even before the unit has fired, sometimes it is true when the unit is attempting to fiire, but cant aim properly....

* Anyyway, so how can I ensure my script is called only at the exact moment that the unit DOES actually fire?

* And why does is "fired" EH true, even before the unit fires???

Thanks lotz.
« Last Edit: 13 Sep 2005, 09:36:59 by funkster »

Kyle Sarnik

  • Guest
Re:Syntax (yeah, i KNow!)
« Reply #9 on: 13 Sep 2005, 21:03:02 »
In reality, I find that often, what may happen is it can go into super slow mo for around [qoute]20 seconds, the tank hasn't fired yet, and only when the tank has fired  (after 20 secs or more )does the script exit and return to normal time.
What does this suggest? - That the "Fired" EH can be true, even before the unit has fired, sometimes it is true when the unit is attempting to fiire, but cant aim properly....

* Anyyway, so how can I ensure my script is called only at the exact moment that the unit DOES actually fire?

* And why does is "fired" EH true, even before the unit fires???

Thanks lotz.
Quote

Please don't make assumptions, when you assume, you make an ASS out of U and ME. Now to solve this with my magic thread solving powers. Make sure you get rid of the command you were using before to slow down the time. I know whats happeneing, the time is being slowed down from SOMETHING ELSE, and only after the "setAccTime 1" from the fired EH is executed does it return to normal. The fired EH only fires when a unit fires, I thought that would be obvious, so the source of the "setacctime 0.1" executing too early is something else that you must have forgotten about, which is probably the original method you tried. So find that command, remove it, and everything should work fine.
« Last Edit: 13 Sep 2005, 21:03:19 by Kyle Sarnik »

funkster

  • Guest
Re:Syntax (yeah, i KNow!)
« Reply #10 on: 14 Sep 2005, 00:19:20 »
No, thats not whats happening.

The setAccTime 0.1  ONLY gets called through "fired.sqs"

"fired.sqs" ONLY gets called through the "fired" EH.

There is varying times between when the time slows down, and when it returns to normal, suggesting the code gets suspended / stuck somewhere in the middle of fired.sqs.

fired.sqs is a small script, printed a couple of replies above, so I wont copy it again.

The only thing that it could get stuck on I think, is the removeEventHandler command, I suggest that the fired EH gets called ddue to something happening (like conditions are good for a shot, and the unit is told to fire, but for some reason is not quite ready to), and then it gets stuck on the removeEH command, which it cant execute until the unit actually does fire - or something like that.

It cant be what you suggest Kyle, because I only have the setAccTime command through the fired EH, nowhere else, so it has to be this that is causing it to be called early somehow......

 ???

------------------------------------------

EDIT: PS, ill double check my script, just to make sure nothing else is causing it, but Im 95% sure I dont have any other command that could cause it to happen..... Away from home cpu right now, but find out b4 long.
« Last Edit: 14 Sep 2005, 00:21:13 by funkster »

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Syntax (yeah, i KNow!)
« Reply #11 on: 14 Sep 2005, 03:57:02 »
on the contrary funkster, what YOU are suggesting is absolutely impossible. event handlers don't just fire because the tank was able to, or was told to, they fire because the tank fires, and only when it fires, no more, no less. if the time slows before the tank fires there IS SOMETHING ELSE causing it.

more importantly, if someone trys to answer the problem that YOU COULDN'T SOLVE, never, NEVER throw it back in their face. out of sheer respect for the people trying to help you, even if their idea or attempt doesn't work, you THANK them, because if they didn't try to help you, you'd never figure it out.


here's a suggestion:
show us the mission, so we can see for ourselves what is happenning, and end this useless bickering

Kyle Sarnik

  • Guest
Re:Syntax (yeah, i KNow!)
« Reply #12 on: 14 Sep 2005, 04:47:49 »
No, thats not whats happening.

The setAccTime 0.1  ONLY gets called through "fired.sqs"

"fired.sqs" ONLY gets called through the "fired" EH.

There is varying times between when the time slows down, and when it returns to normal, suggesting the code gets suspended / stuck somewhere in the middle of fired.sqs.

fired.sqs is a small script, printed a couple of replies above, so I wont copy it again.

The only thing that it could get stuck on I think, is the removeEventHandler command, I suggest that the fired EH gets called ddue to something happening (like conditions are good for a shot, and the unit is told to fire, but for some reason is not quite ready to), and then it gets stuck on the removeEH command, which it cant execute until the unit actually does fire - or something like that.

It cant be what you suggest Kyle, because I only have the setAccTime command through the fired EH, nowhere else, so it has to be this that is causing it to be called early somehow......

 ???

------------------------------------------

EDIT: PS, ill double check my script, just to make sure nothing else is causing it, but Im 95% sure I dont have any other command that could cause it to happen..... Away from home cpu right now, but find out b4 long.

Ah I see now, and in that case I believe I can solve your problem. Actualy I'm sure you can figure it out if I give you this hint, ~0.8 is not 0.8 seconds when acctime is equal to 0.1  ;)  Also, just triplecheck everything because it sounds like there is something else slowing down the time before the unit fires.

Also, if a script comes accross an error, it won't pause, but keeps on running untill it is told to finish. And, yea, don't say I'm wrong I do know what I am talking about.

Offline Roni

  • Members
  • *
  • Play the Game !
Re:Syntax (yeah, i KNow!)
« Reply #13 on: 14 Sep 2005, 04:55:47 »
Hello All

Just passing through an I thought that I'd chuck in my two cents.

Here's a fundamental query for the community - does the "~pause" command refer to computer clock speed or does it refer to some sort of "game" speed ?

In other words, if I "setAccTime 0.1", then have a line that says "~1", does the script wait 1 second or 10 ?

It's a simple query to answer (pity I'm at work !).  Simply write a script that does this


setAccTime 0.1
~1
SetAccTime 1.0
hint "Hello world !"


Now all you do is run the script and time the delay until the hint is displayed - I'll bet that it will be 10 seconds.

If this is the case then there is the answer to your problem.

If not then I'm stuffed too !

Cheers



Roni


Kyle Sarnik

  • Guest
Re:Syntax (yeah, i KNow!)
« Reply #14 on: 14 Sep 2005, 05:03:59 »
Hello All

Just passing through an I thought that I'd chuck in my two cents.

Here's a fundamental query for the community - does the "~pause" command refer to computer clock speed or does it refer to some sort of "game" speed ?

In other words, if I "setAccTime 0.1", then have a line that says "~1", does the script wait 1 second or 10 ?

It's a simple query to answer (pity I'm at work !).  Simply write a script that does this


setAccTime 0.1
~1
SetAccTime 1.0
hint "Hello world !"


Now all you do is run the script and time the delay until the hint is displayed - I'll bet that it will be 10 seconds.

If this is the case then there is the answer to your problem.

If not then I'm stuffed too !

Cheers



Roni



Yes thats what I was trying to hint to funkster, that when you slow down time in the game, you actualy slow down ALL time, anything in seconds is also slowed down. so 0.8 seconds in 0.1 acctime would really be ~ (approx) 8 seconds.