Home   Help Search Login Register  

Author Topic: How to Stop a Script?  (Read 857 times)

0 Members and 1 Guest are viewing this topic.

Totibbs

  • Guest
How to Stop a Script?
« on: 06 Nov 2002, 17:20:21 »
Ive a little script:

Quote
#loop

?stopScript1 = true goto: end

Medic playmove"FXStandDip"
Goto "loop"

#end
exit

but how can I stop it?
It must stop if a man called "man" activates a trigger. With his present.

So I think Ive to make another script. Thats no problem. But what must I write in that other script?
Probbably something with: ?stopScript1 = false so the trigger can make it "true".

but how?  ???

Offline Ranger

  • Members
  • *
  • Hoo-ah!
Re:How to Stop a Script?
« Reply #1 on: 06 Nov 2002, 20:53:59 »
If I understand you correctly, you want a trigger to activate when man is present, which will cause your script to exit.

If so, in the activation field of your trigger, put

stopScript1 = true

That's all you need to do.

By the way, there's a few errors in your code.  Change the following line:

?stopScript1 = true goto: end

To:

?stopScript1 == true : goto "end"

Optionally, you can shorten your code to the following:

? stopScript1 : exit

Using this, you can eliminate the #end section.

In any case, you do not need a second script to do anything else.  However, if you want to follow good coding practices, you could create an init.sqs script if you don't already have it, and in this script put the following line:

stopScript1 = false
Ranger

Totibbs

  • Guest
Re:How to Stop a Script?
« Reply #2 on: 06 Nov 2002, 23:18:34 »
I tried anything. but nothing worked.

can you give me an copy/paste example? please?  ;D

Offline Ranger

  • Members
  • *
  • Hoo-ah!
Re:How to Stop a Script?
« Reply #3 on: 07 Nov 2002, 00:27:08 »
Okay, let me explain it step by step.  I assumed that you were doing certain things, but maybe you weren't.

1. Put the following code in your script:

#loop

? stopScript1 : exit

Medic playmove"FXStandDip"
Goto "loop"


2. Execute your script when the mission begins, or whenever you planned to have it execute.  You can put this code in the initialization field of a unit, in a trigger that activates upon the mission starting, or in the init.sqs script.  Use the following code in one of the afore mentioned places:

[] exec "YourScriptName.sqs"

3. Place in the mission the unit you want to be named man, and change the name field to man.

4. Create a trigger.  Group the trigger with man by using the group feature of the editor.  This is done by hitting the F2 key, then clicking on man or the trigger and dragging the blue line to the other, then releasing the mouse button.

5. Edit the trigger's properties and change its activation type to Vehicle (I think) and Present.

6. In the trigger's activation field, put the following code:

stopScript1 = true
Ranger

Totibbs

  • Guest
Re:How to Stop a Script?
« Reply #4 on: 07 Nov 2002, 16:19:16 »
I dont get it.

The trigger which said: stopScript1 = true can be activated. I tested it with an "effect". And I heard that effect.

But the Medic doesnt stop with his push-ups...

so Ive done all points (1 to 6). And the trigger works. But that stupid soldier doesnt stop  :'(

Offline Ranger

  • Members
  • *
  • Hoo-ah!
Re:How to Stop a Script?
« Reply #5 on: 07 Nov 2002, 18:43:39 »
Admittedly, I am not overly familiar with using the playmove command, so someone else might have better insight on this issue.

That said, my guess is that you need to give the medic some playmove action other than the pushup in order to make him stop.  Depending on what you are trying to achieve, try the FXStandAtt animation.

Try using the following code in your script:

#loop

? stopScript1 : Medic playmove "FXStandAtt"; exit

Medic playmove "FXStandDip"

Goto "loop"


So, this will cause the medic to do the FXStandAtt animation before exiting the script.  I have a feeling that he'll instantly jump from doing a pushup to standing at attention, so you'll have to fiddle around to get the right animation that will look good.
Ranger

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:How to Stop a Script?
« Reply #6 on: 08 Nov 2002, 08:27:38 »
i think dat da main prob is dat ur script is not righten right  ;D here is wat u need

Code: [Select]
#loop

? stopScript1 : Medic switchmove "null"; exit

Medic playmove "FXStandDip"
~2.7

Goto "loop"

btw i sugest u try 2 change da number 2.7 till u get da right timing

~2.7 means it will wait 2.7 sec b4 continuing wid script so da medic can finish his first pushups b4 startin doin mor  ;D

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

Totibbs

  • Guest
Re:How to Stop a Script?
« Reply #7 on: 09 Nov 2002, 15:28:43 »
It seems that it works. thx :)