Home   Help Search Login Register  

Author Topic: Using Boolean =! Boolean code  (Read 2278 times)

0 Members and 1 Guest are viewing this topic.

Offline NightJay0044

  • Former Staff
  • ****
  • Let's make OFPEC great again
    • My Steam Workshop
Using Boolean =! Boolean code
« on: 04 Sep 2008, 21:01:29 »
Hi all this script didn't work for me. The error it gave me was "error invalid number in expression".

Here is my script with the code as you can see very simple probably but basically it's acting like a trigger saying if the E1 soldier is dead then a hint will pop up saying that.

Quote
; A script that will say E1 is dead when you have killed him.

_a = alive E1;

if(!_a) then
{
    hint "The enemy is dead!";
}

exit

So I'm not sure how to fix it thank you.
Who's hyped for Arma4, long live Arma!

Offline Gcfungus

  • Members
  • *
Re: Using Boolean =! Boolean code
« Reply #1 on: 04 Sep 2008, 23:43:46 »
I don't really know how to use the event handlers, but it looks to me as though you assign _a the value true and then use it in a check. Essesntially your checking "if not false", which doesn't make any sense. Can't you just put this in:
Code: [Select]
if(!alive E1) thenI'm not sure if it'll work though, and the syntax may be wrong, I'm not sure about this but it's a suggestion.
 :)
The object of war is not to die for your country, but to make the other bastard die for his.
~George Patton

Offline NightJay0044

  • Former Staff
  • ****
  • Let's make OFPEC great again
    • My Steam Workshop
Re: Using Boolean =! Boolean code
« Reply #2 on: 05 Sep 2008, 00:10:23 »
Yeah this doesn't work either. It still gives me the same error message. Basically I'm trying to have a west soldier eliminate an east soldier and having this script say "hint" The Enemy is dead!.  In game all I have is one west soldier and one east soldier.

Well basically I was just trying to figure out how to use the command
Quote
! a

I dont' know what it means or how to use it or how many different ways to use it.

See where scripting is simpler for me is when you can use commands such as

Quote
this addeaponcargo "Ak47",1]; etc......

But when it comes to using the commands such as;

Quote
<, !, a, _a...etc..

It's harder for me because I can't always see how it relates to soldiers in the mission editor and stuff.


thanks.
Who's hyped for Arma4, long live Arma!

Offline dr. seltsam

  • Members
  • *
Re: Using Boolean =! Boolean code
« Reply #3 on: 05 Sep 2008, 02:40:01 »
hi,

i was never able to make a structured syntax working in .sqs code like this:

Code: [Select]
if (condition) then
           {
                doSomething;
           }

You have to write your command in one line:

Code: [Select]
_a=alive E1
if (!_a) then {hint "This guy is dead"}

 :cool2:

Offline NightJay0044

  • Former Staff
  • ****
  • Let's make OFPEC great again
    • My Steam Workshop
Re: Using Boolean =! Boolean code
« Reply #4 on: 05 Sep 2008, 06:14:24 »
Why do you have to use a one line command?
Who's hyped for Arma4, long live Arma!

Offline dr. seltsam

  • Members
  • *
Re: Using Boolean =! Boolean code
« Reply #5 on: 05 Sep 2008, 14:50:36 »
I think it is because a .sqs script gets interpreted line by line. The interpreter wants to find a complete working syntax in one line, and not only a fragment of it. If you write a .sqf function, you can have the structured syntax.

 :)


#EDIT: Removed the unnecessary quote; no need to quote the whole previous post you're replying to..     h-
« Last Edit: 05 Sep 2008, 14:59:52 by h- »