OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Blanco on 22 Jul 2007, 01:38:09

Title: Create a unique bolean for each group
Post by: Blanco on 22 Jul 2007, 01:38:09
I have a few scripts, several groups are running the same scripts. I want to create a unique bolean to terminate all scripts for each group.
I'm thinking about combining a boleanname + the groupname.
Let's say my boleanname is ENDSCRIPTS and my group is defined as grp1, so the dynamic bolean should be ENDSCRIPTSgrp1. When you set this true only the scripts for grp1 should terminate.
How can this be done? Is there a way to return the physical groupname?



Title: Re: Create a unique bolean for each group
Post by: LCD on 22 Jul 2007, 01:44:41
to do it u have to use da format command as mandoble explains here (http://www.ofpec.com/forum/index.php?topic=29817.msg203648#msg203648)...

now 2 get da grpname.... i dont really know... strange dat i never thought bout it b4

LCD OUT
Title: Re: Create a unique bolean for each group
Post by: Mandoble on 22 Jul 2007, 12:28:58
try this:
Code: [Select]
_unit = _this select 0
call compile (format["_ENDSCRIPT%1", group _unit] = true)
? (call compile (format["_ENDSCRIPT%1", group _unit])): hint "it is true"
Title: Re: Create a unique bolean for each group
Post by: Blanco on 22 Jul 2007, 14:45:57
Thx Mandoble

I've tested your code and I got a error missing ;
_grp is returned as WEST 1-1-A
So in the example the bolean should be _ENDSCRIPT WEST 1-1-A
Is that an error because spaces are not allowed in boleans/vars?
Is there a reason for the underscore?

Can I return the unit's name I gave in the editor? (in the name field)

*looking for a command that does this*

 
Title: Re: Create a unique bolean for each group
Post by: Mandoble on 22 Jul 2007, 15:01:24
Yep, you can get the editor name with vehicleVarName comman.
Title: Re: Create a unique bolean for each group
Post by: Blanco on 22 Jul 2007, 15:16:48
Thx, works great


But it seems there something wrong with the call compile stuff because I still got an error.

It's:
Quote
...at ["_ENDSCRIPT%1", Vehiclename _unit] |#| - true)' Error Missing )

got :

Code: [Select]
_unit = _this select 0
;hint format ["%1",Vehiclevarname _unit]

call compile (format["ENDSCRIPT%1", VehicleVarname _unit] = true)
? (call compile (format["ENDSCRIPT%1",VehicleVarname _unit])): hint "it is true"

edit: Hmmm, wait a sec...  :confused:

You don't need  = true to check a condition, right?

edit2: Indeed, works fine now. Thx a lot.







Title: Re: Create a unique bolean for each group
Post by: Mandoble on 22 Jul 2007, 15:25:20
right