Home   Help Search Login Register  

Author Topic: Create a unique bolean for each group  (Read 1525 times)

0 Members and 1 Guest are viewing this topic.

Offline Blanco

  • Former Staff
  • ****
Create a unique bolean for each group
« 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?



Search or search or search before you ask.

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re: Create a unique bolean for each group
« Reply #1 on: 22 Jul 2007, 01:44:41 »
to do it u have to use da format command as mandoble explains here...

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

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

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Create a unique bolean for each group
« Reply #2 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"

Offline Blanco

  • Former Staff
  • ****
Re: Create a unique bolean for each group
« Reply #3 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*

 
« Last Edit: 22 Jul 2007, 14:50:32 by Blanco »
Search or search or search before you ask.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Create a unique bolean for each group
« Reply #4 on: 22 Jul 2007, 15:01:24 »
Yep, you can get the editor name with vehicleVarName comman.

Offline Blanco

  • Former Staff
  • ****
Re: Create a unique bolean for each group
« Reply #5 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.







« Last Edit: 22 Jul 2007, 15:26:32 by Blanco »
Search or search or search before you ask.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Create a unique bolean for each group
« Reply #6 on: 22 Jul 2007, 15:25:20 »
right