# Trigger problem

## Recommended Posts

I wrote "A and B and C" as the condition of the trigonometric function, but the system told me it was wrong.. So, how to write it?

##### Share on other sites

Condition: A and B and C;

What?

##### Share on other sites
4 hours ago, sarogahtyp said:

What?

I wrote "A and B and C" in the condition box of the trigger, which means that the trigger is activated when trigger A ,B ,C takes effect. This approach is indeed effective, but the system prompts a writing error. What kind of writing format is correct?

##### Share on other sites
3 hours ago, CN-bbdnmd said:

I wrote "A and B and C" in the condition box of the trigger, which means that the trigger is activated when trigger A ,B ,C takes effect. This approach is indeed effective, but the system prompts a writing error. What kind of writing format is correct?

You shoud write a=true in A trigger's activation field. B=true in B... etc. Then your 4th trigger will works.

##### Share on other sites
20 hours ago, bardosy said:

You shoud write a=true in A trigger's activation field. B=true in B... etc. Then your 4th trigger will works.

or

triggerActivated Atrigger (if Atrigger is a trigger)  && triggerActivated Btrigger && triggerActivated Ctrigger

which can be optimized:

[Atrigger,Btrigger,Ctrigger] findIf {!triggerActivated _x} == -1

Note: Avoid giving a variable (in on activation field) the same name as the trigger itself. I.e. a=true in A trigger's activation is not a good idea.
a (A) will become a boolean instead of a trigger (object). That can work for simple scenario with one trigger; that can lead to weird behavior for further scripts if any reference to the trigger).

@CN-bbdnmd You should share your problem if you want a solution. Resolving trigonometric function with 3 trigger activations seems strange, to say the least. @sarogahtyp is skilled at that. So, if you want, start from your goal instead of question aside.

• 1

##### Share on other sites
9 hours ago, bardosy said:

You shoud write a=true in A trigger's activation field. B=true in B... etc. Then your 4th trigger will works.

In fact, that’s what I wrote before....The trigger does take effect, but the system prompts a writing error :A and B and C.. there is a format error

##### Share on other sites
9 hours ago, pierremgi said:

or

triggerActivated Atrigger (if Atrigger is a trigger)  && triggerActivated Btrigger && triggerActivated Ctrigger

which can be optimized:

[Atrigger,Btrigger,Ctrigger] findIf {!triggerActivated _x} == -1﻿﻿

Note: Avoid giving a variable (in on activation field) the same name as the trigger itself. I.e. a=true in A trigger's activation is not a good idea.
a (A) will become a boolean instead of a trigger (object). That can work for simple scenario; that can lead to weird behavior for further scripts if any reference to the trigger).

@CN-bbdnmd You should share your problem if you want a solution. Resolving trigonometric function with 3 trigger activations seems strange, to say the least. @sarogahtyp is skilled at that. So, if you want, start from your goal instead of question aside.

Thank you i will try.

##### Share on other sites

Trigger a :a=true;   Trigger b: b=true;  Trigger c : c =true;        Trigger d: condition: a AND b AND c;

The system error is as follows: call{a |#|AND b AND c} Error

I tried the method you provided and there will still be similar formatting errors.

This error symbol seems to be critical： |#|，，，it may suggest where the error is, but I can’t solve it

##### Share on other sites

That's just a typo with invisible character when you copy paste a raw code on forum. The # indicates the location of this character. Try to locate it by cursor step by step, (left or right arrow), the cursor seem to halt on it. Delete it.

all right

##### Share on other sites
3 minutes ago, CN-bbdnmd said:

triggerActivated Atrigger (if Atrigger is a trigger)  && triggerActivated Btrigger && triggerActivated Ctrigger ，this way have the same problem

I hope you removed (if Atrigger is a trigger) !!

And or course, it's an example for triggers named Atrigger Btrigger, Ctrigger.  You must adapt it to your trigger names.

##### Share on other sites

I know the problem.

The reason for this error is that the conditions are not met at the same time.

After many experiments, I found that when the triggers A B C are all active at the same time, the code that triggers D will not report an error. If A B C  is not valid at the same time, then the part that is not valid will be reported as an error.

##### Share on other sites
10 hours ago, CN-bbdnmd said:

I know the problem.

The reason for this error is that the conditions are not met at the same time.

After many experiments, I found that when the triggers A B C are all active at the same time, the code that triggers D will not report an error. If A B C  is not valid at the same time, then the part that is not valid will be reported as an error.

Yes. Normal. The fact is you stay on a wrong way with variable names same as trigger names, because a trigger can't be true. It can be activated or not.

So, did you test:

triggerActivated A && triggerActivated B && triggerActivated C

despite the fact i gave you an example with some more adapted trigger names?

Don't you want to share your aim, just in case there are better solutions than triggers?

• 1

##### Share on other sites

Place 3 boxes on the map
box1
box2
box3

Place 3 triggers on the map
trigger1
trigger2
trigger3

trigger1 is used to delete box1 with the command    deletevehicle  box1;
trigger2 is used to delete box2 with the command    deletevehicle  box2;
trigger3 is used to delete box3 with the command    deletevehicle  box3;

Place a 4th trigger on the map.  When all 3 boxes are deleted trigger 4 will fire. The command is:
!(alive box1)  &&  !(alive box2)  &&  !(alive box3)

.

.

• 1

##### Share on other sites

I refer to post 6 in this thread and I now understand what he was trying to say.

Create 3 triggers and name them:

t1

t2

t3

Now create a 4th trigger.  In the activation field of the 4th trigger:

triggerActivated  t1  &&  triggerActivated   t2  &&   triggerActivated   t3

If the 3 triggers are activated the 4th trigger will fire.

Thank you to Pierremgi  as I have learnt something today!

##### Share on other sites
2 hours ago, Joe98 said:

t1

t2

t3

triggerActivated t1 && triggerActivated t2 && triggerActivated t3

You may encounter some problems: For example, a single trigger t3 will make t4 take effect without the need for t1 or t2. I have encountered such a problem before.

##### Share on other sites
54 minutes ago, CN-bbdnmd said:

You may encounter some problems: For example, a single trigger t3 wil﻿l make t4 take effect without the need for t1 or t2.﻿ I have encountered such a problem before.  ﻿

just not true!

##### Share on other sites
43 minutes ago, CN-bbdnmd said:

You may encounter some problems: For example, a single trigger t3 will make t4 take effect without the need for t1 or t2. I have encountered such a problem before.

Believe me and sarogahtyp , if you write:

triggerActivated A && triggerActivated B && triggerActivated C

as condition of trigger D , there is no chance to activate D if one of  A , B and C triggers is not activated. You must activate A and B and C to activate D.

Every problem encountered before is your misunderstanding on what a variable is and a trigger is. See posts above.

##### Share on other sites
22 minutes ago, pierremgi said:

triggerActivated A && triggerActivated B && triggerActivated C

Thank you brother. I will try a few more times, maybe there was a problem with my previous experiment operation process which led to the wrong conclusion.