Home   Help Search Login Register  

Author Topic: Turn off Script  (Read 720 times)

0 Members and 1 Guest are viewing this topic.

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
Turn off Script
« on: 24 Jun 2004, 18:49:44 »
How can I turn a script off via a trigger in the editor?

Here's what I'm doing.
I have a helo flying from a dirt strip. I'm using Vektorboson's helidust script.
The dust on the dirt strip is, well, dirt colour.
My helo will finish up on grass.

Now I tried just having two of the same scripts with differewnt names. This half worked. When the helo hit the trigger to exec the grass script, it did indeed create grass dust. However I still have the dirt dust along side it.

Any ideas on ending the script, Via a Trigger?
Cheers. ;D
James Andrew Wilkinson 1977 - 2005 R.I.P.
"If it ain't the friggin' incoming it's the friggin' outgoing. Only difference is who gets the friggin' grease, and that ain't no friggin' difference at all."

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:Turn off Script
« Reply #1 on: 24 Jun 2004, 18:58:53 »
I had a similar problem, except mine were a lot trickier since I could not use global booleans and the script was supposed to run more than once.

However, yours should be a piece of cake.

Somewhere in the loop of your script that creates dust, put in a global boolean condition, like:

? ArmstyIsTheKing == True : exit

And in a trigger put:

ArmstyIsTheKing = true

:beat: *Gets Shot* :beat:

Offline Blanco

  • Former Staff
  • ****
Re:Turn off Script
« Reply #2 on: 24 Jun 2004, 19:01:03 »
I modified heli_dust by Vektorboson, now you can choose maximum 2 different colours on one map. In the example I change NAM dust into GRASS dust.
I added the bolean othercolor = true/false to end the script when you enter a new area (other texture)

How to change the color dust.

You need a trigger that covers the area with the different groundtexture. . If you want to cover other pieces of ground that's on the shore, don't worry your trigger may cover the sea, the script will still change the dust in waterspashes when you fly oversea.

Example : place a helicopter and name it helo1

Put this in your trigger

Code: [Select]
ACTIVATION : WEST, Repeatedly

Condition : Heli1 in thislist
On activation : othercolor = true; [heli1,"NAM"] exec "heli_dust+.sqs"
On deactivation : othercolor = true; [heli1,"GRASS"] exec "heli_dust+.sqs"


Here's the modified heli_dust script

heli_dust+.sqs

Code: [Select]
 
; Heli Dust+ script by Vektorboson; modified by Blanco
; see _sensor and _calcH for above sea level calculation!
; execute just
; [name of the chopper, colour of dust] exec "heli_dust+.sqs"
;Valid colours are : "GRASS","SAND","DUST","DESERT","NAM" and "SNOW"

_chopper = _this select 0
_dust = _this select 1
~1
othercolor = false
?_dust == "GRASS": goto "1"
?_dust == "SAND" :goto "2"
?_dust == "DUST" :goto "3"
?_dust == "DESERT" :goto "4"
?_dust == "NAM" : goto "5"
?_dust == "SNOW" : goto "6"

#1
HDCOLOR  = [[0.35,0.35,0.3,0], [0.2, 0.2, 0.1, 0.5],[0.2, 0.27, 0.15, 0]]
goto "next"
#2
HDCOLOR   = [[0.35,0.35,0.3,0],[0.35,0.35,0.3,0],[0.6, 0.57, 0.5, 0.5],[0.5, 0.47, 0.4, 0]]
goto "next"
#3
HDCOLOR   = [[0.4,0.4,0.4,0],[0.6,0.6,0.6,0],[0.4,0.4,0.4,0.7], [0.65, 0.6, 0.5, 0]]
goto "next"
#4
HDCOLOR = [[0.4,0.4,0.4,0],[0.6,0.6,0.6,0],[0.7,0.7,0.65,1], [0.65, 0.6, 0.5, 0]]
goto "next"
#5
HDCOLOR = [[ 0.4,0.3, 0.2,0.2], [ 0.4,0.3, 0.2,0.25], [0.4,0.3, 0.2, 0.3], [ 0.4, 0.3, 0.2, 0.1]]
goto "next"
#6
HDCOLOR = [[0.95,0.95,0.95,0.2], [0.95,0.95, 0.95,0.4], [0.95 ,0.95,0.95,0.4], [1,1,1,0.1]]
goto "next"


#next
HDCOLORWATER = [[0.8,0.8,0.9,0],[0.9,0.9,1,0.7],[0.8,0.8,0.9,0],[0.8,0.8,0.9,0]]

_null = "scalar bool array string 0xfcffffef"

private ["_sensor"];
_sensor = "EmptyDetector" createVehicle [0,0,0]
_calcH = {private["_result"]; _sensor setpos [getpos _chopper select 0, getpos _chopper select 1, 0]; _result = getpos _sensor select 2; _result};

?format["%1",HDSIN ] == _null: HDSIN = call {private["_i","_result"]; _result = []; _i = 0; while "_i < 50" do {_result = _result + [sin (7.2*_i)*15]; _i = _i+1;}; _result}
?format["%1",HDCOS ] == _null: HDCOS = call {private["_i","_result"]; _result = []; _i = 0; while "_i < 50" do {_result = _result + [cos (7.2*_i)*15]; _i = _i + 1}; _result}

; these are color prefabs! You may adjust or add some new if you like!


; color for this helictoper
_icolor = HDCOLOR

_repeat = true
_lifetime = 2
_shape = "cl_basic"
_color = _icolor

; here comes all the visual part!

#repeat
?(getpos _chopper select 2) < 30 && speed _chopper < 120 && isEngineOn _chopper : goto "loop"
?othercolor : goto "exit"
~0.1
goto "repeat"


#loop
_pos = getpos _chopper
_x = _pos select 0
_y = _pos select 1

_i = 0
#l1
?othercolor : goto "exit"
_vel = [HDSIN select _i, HDCOS select _i, 0]
_size1 = random 2
_size2 = random 3 + 3
_size = [_size1, _size2]
drop [_shape, "", "Billboard", _lifetime, _lifetime, [_x, _y, 0], _vel, 0, 0.2, 0.157, 0.001, _size, _color, [0], 0.1, 0.2, "", "", ""]
_i = _i + 1
?_i < 50: goto "l1"
~0.01
_color = _icolor
_shape = "cl_basic"
?othercolor : goto  "exit"
?abs(_this call _calcH) < 3: _color = HDCOLORWATER; _shape = "cl_water"
?(getpos _chopper select 2) < 30 && speed _chopper < 120 && isEngineOn _chopper: goto "loop"
?_repeat && alive _chopper : goto "repeat"

#exit
deletevehicle _sensor
exit



« Last Edit: 25 Jun 2004, 00:27:14 by Blanco »
Search or search or search before you ask.

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
Re:Turn off Script
« Reply #3 on: 24 Jun 2004, 19:09:47 »
Diddn't work "Armsty".
Where exactly would you suggest putting it?


Blanco, what do you mean? there is the ability to have any colour with Vektorboson's script. Even more than the pre-sets.
James Andrew Wilkinson 1977 - 2005 R.I.P.
"If it ain't the friggin' incoming it's the friggin' outgoing. Only difference is who gets the friggin' grease, and that ain't no friggin' difference at all."

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:Turn off Script
« Reply #4 on: 24 Jun 2004, 19:12:04 »
If you gimme that script so I can look at it I'll sort it out for ya. :-*

:beat: *Gets Shot* :beat:

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
Re:Turn off Script
« Reply #5 on: 24 Jun 2004, 19:26:36 »
I don't understand a word of that Blanco. How does it now what the new texture colour is?

Her's the script Armstrong,

; Heli Dust script by Vektorboson
; see _sensor and _calcH for above sea level calculation!
; execute just
; MyHeli exec "effects\heli_dust.sqs"



_null = "scalar bool array string 0xfcffffef"

private ["_sensor"];

_sensor = "EmptyDetector" createVehicle [0,0,0]
_calcH = {private["_result"]; _sensor setpos [getpos _this select 0, getpos _this select 1, 0]; _result = getpos _sensor select 2; _result};

?format["%1",HDSIN ] == _null: HDSIN = call {private["_i","_result"]; _result = []; _i = 0; while "_i < 50" do {_result = _result + [sin (7.2*_i)*15]; _i = _i+1;}; _result}
?format["%1",HDCOS ] == _null: HDCOS = call {private["_i","_result"]; _result = []; _i = 0; while "_i < 50" do {_result = _result + [cos (7.2*_i)*15]; _i = _i + 1}; _result}

; these are color prefabs! You may adjust or add some new if you like!

HDCOLORGRASS  = [[0.35,0.35,0.3,0], [0.2, 0.2, 0.1, 0.5],[0.2, 0.27, 0.15, 0]]
HDCOLORSAND   = [[0.35,0.35,0.3,0],[0.35,0.35,0.3,0],[0.6, 0.57, 0.5, 0.5],[0.5, 0.47, 0.4, 0]]
HDCOLORDUST   = [[0.4,0.4,0.4,0],[0.6,0.6,0.6,0],[0.4,0.4,0.4,0.7], [0.65, 0.6, 0.5, 0]]
HDCOLORDESERT = [[0.4,0.4,0.4,0],[0.6,0.6,0.6,0],[0.7,0.7,0.65,1], [0.65, 0.6, 0.5, 0]]
HDCOLORWATER = [[0.8,0.8,0.9,0],[0.9,0.9,1,0.7],[0.8,0.8,0.9,0],[0.8,0.8,0.9,0]]

; color for this helictoper
_icolor = HDCOLORSAND

_repeat = true
_lifetime = 2
_shape = "cl_basic"
_color = _icolor

; here comes all the visual part!

#repeat
@(getpos _this select 2) < 30 && speed _this < 120 && isEngineOn _this

#loop

_pos = getpos _this
_x = _pos select 0
_y = _pos select 1

_i = 0
#l1
_vel = [HDSIN select _i, HDCOS select _i, 0]
_size1 = random 2
_size2 = random 3 + 3
_size = [_size1, _size2]
drop [_shape, "", "Billboard", _lifetime, _lifetime, [_x, _y, 0], _vel, 0, 0.2, 0.157, 0.001, _size, _color,
  • , 0.1, 0.2, "", "", ""]

_i = _i + 1
?_i < 50: goto "l1"
~0.01
_color = _icolor
_shape = "cl_basic"
?abs(_this call _calcH) < 3: _color = HDCOLORWATER; _shape = "cl_water"
?(getpos _this select 2) < 30 && speed _this < 120 && isEngineOn _this: goto "loop"

?_repeat && alive _this : goto "repeat"
James Andrew Wilkinson 1977 - 2005 R.I.P.
"If it ain't the friggin' incoming it's the friggin' outgoing. Only difference is who gets the friggin' grease, and that ain't no friggin' difference at all."

Offline Blanco

  • Former Staff
  • ****
Re:Turn off Script
« Reply #6 on: 24 Jun 2004, 19:39:37 »
 ???

How can I explain this?   :-\

I'm sure it works because Scorpion've used it in a NAM mission...
The script doesn't know the color of the groundtexture, you have to define the colors in the exec line (2th parameter)

In your case , place a trigger over the dirtstrip where your chopper (heli1) flies with :

Code: [Select]
ACTIVATION : WEST, Repeatedly

Condition : Heli1 in thislist
On activation : othercolor = true; [heli1,"DUST"] exec "heli_dust+.sqs"
On deactivation : othercolor = true; [heli1,"GRASS"] exec "heli_dust+.sqs"

When the chopper leave the area (trigger) the DUSTcolor will change in GRASS color, the script exits first and runs again (with ~1 sec delay) with a different color (GRASS)
You can place more triggers on other area's with dirt.

« Last Edit: 25 Jun 2004, 00:26:11 by Blanco »
Search or search or search before you ask.

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:Turn off Script
« Reply #7 on: 24 Jun 2004, 20:01:56 »
Code: [Select]
; Heli Dust script by Vektorboson
; see _sensor and _calcH for above sea level calculation!
; execute just
; MyHeli exec "effects\heli_dust.sqs"



_null = "scalar bool array string 0xfcffffef"

private ["_sensor"];

_sensor = "EmptyDetector" createVehicle [0,0,0]
_calcH = {private["_result"]; _sensor setpos [getpos _this select 0, getpos _this select 1, 0]; _result = getpos _sensor select 2; _result};

?format["%1",HDSIN ] == _null: HDSIN = call {private["_i","_result"]; _result = []; _i = 0; while "_i < 50" do {_result = _result + [sin (7.2*_i)*15]; _i = _i+1;}; _result}
?format["%1",HDCOS ] == _null: HDCOS = call {private["_i","_result"]; _result = []; _i = 0; while "_i < 50" do {_result = _result + [cos (7.2*_i)*15]; _i = _i + 1}; _result}

; these are color prefabs! You may adjust or add some new if you like!

HDCOLORGRASS  = [[0.35,0.35,0.3,0], [0.2, 0.2, 0.1, 0.5],[0.2, 0.27, 0.15, 0]]
HDCOLORSAND   = [[0.35,0.35,0.3,0],[0.35,0.35,0.3,0],[0.6, 0.57, 0.5, 0.5],[0.5, 0.47, 0.4, 0]]
HDCOLORDUST   = [[0.4,0.4,0.4,0],[0.6,0.6,0.6,0],[0.4,0.4,0.4,0.7], [0.65, 0.6, 0.5, 0]]
HDCOLORDESERT = [[0.4,0.4,0.4,0],[0.6,0.6,0.6,0],[0.7,0.7,0.65,1], [0.65, 0.6, 0.5, 0]]
HDCOLORWATER = [[0.8,0.8,0.9,0],[0.9,0.9,1,0.7],[0.8,0.8,0.9,0],[0.8,0.8,0.9,0]]

; color for this helictoper
_icolor = HDCOLORSAND

_repeat = true
_lifetime = 2
_shape = "cl_basic"
_color = _icolor

; here comes all the visual part!

#repeat
@(getpos _this select 2) < 30 && speed _this < 120 && isEngineOn _this

#loop

_pos = getpos _this
_x = _pos select 0
_y = _pos select 1

_i = 0
#l1
_vel = [HDSIN select _i, HDCOS select _i, 0]
_size1 = random 2
_size2 = random 3 + 3
_size = [_size1, _size2]
drop [_shape, "", "Billboard", _lifetime, _lifetime, [_x, _y, 0], _vel, 0, 0.2, 0.157, 0.001, _size, _color, [0], 0.1, 0.2, "", "", ""]
_i = _i + 1

; ATTENTION ARCHITECHT!!! HERE IS THE LINE!!!

? BOOLEAN == TRUE : EXIT

; END OF LINE

?_i < 50: goto "l1"
~0.01
_color = _icolor
_shape = "cl_basic"
?abs(_this call _calcH) < 3: _color = HDCOLORWATER; _shape = "cl_water"
?(getpos _this select 2) < 30 && speed _this < 120 && isEngineOn _this: goto "loop"

?_repeat && alive _this : goto "repeat"

Try that. You have to check with Vektorboson if it's OK with him that you edit his script.

:beat: *Gets Shot* :beat:
« Last Edit: 24 Jun 2004, 20:02:41 by The real Armstrong »

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
Re:Turn off Script
« Reply #8 on: 24 Jun 2004, 23:41:04 »
Didn't work Armstrong. I got this error message,

'Boolean == TRUE |#|': Error ==: TypeAny, expected Number, String, Object, Side, Group


I also got error messages similar when trying the Blanco idea.

 :(

Surely there must be a simpler way to force a script to terminate?
James Andrew Wilkinson 1977 - 2005 R.I.P.
"If it ain't the friggin' incoming it's the friggin' outgoing. Only difference is who gets the friggin' grease, and that ain't no friggin' difference at all."

Offline Blanco

  • Former Staff
  • ****
Re:Turn off Script
« Reply #9 on: 25 Jun 2004, 00:25:26 »
I'm sure my example works, I can make you a test till tuesday.
note :
There were 2 typos in the exec line...  
helidust+sqs instead of heli_dust+.sqs

About...
Quote
?Bolean == true

He means you have to put a bolean there to stop the script


eg :
Code: [Select]
?stopscript : exit

And then in a trigger or waypoint in the onactivation field :
Code: [Select]
Stopscript = true

Once Stopscript is set true the script exits.

I do the same, the difference is that my bolean is named othercolor and you can run the same script again , this time with another dust colour
Valid colours are : "GRASS","SAND","DUST","DESERT","NAM" and "SNOW"

 








 
« Last Edit: 25 Jun 2004, 00:35:44 by Blanco »
Search or search or search before you ask.