Jump to content
Djavu

When to use >= to compare?

Recommended Posts

Hello, I need some help.
When I use the  >=  comparison in the debugger it returns true, however, when using in a script it makes false. Here's the code below: (Sorry for my English)

 

_grupoUnits = []; 
	{  
	if ((_x distance L_base) < 200) then 
	{  
	_grupoUnits pushback _x;  
	};  
	} foreach allplayers;
	_grupoUnits;  
	_playercount = count _grupoUnits;
	
	[[west, "BASE"],format["There are %1 operators here in Base. We will continue this operation only if 3 of you cooperate.",_playercount]] remoteexec ["sidechat",[0,-2] select isdedicated];

waitUntil{!M_time};

if({_x distance port1 > 150}count _grupoUnits >= 3)then{ //works on debugger
	waituntil {sleep 1;int_base;};

	sleep 5;
	"MySound"   remoteExec [ "playSound",[0,-2] select isDedicated,false];
	sleep 15;
	"MySound"  remoteExec [ "playSound",[0,-2] select isDedicated,false];

}else{
	m_falho = true;
	["end1",false] remoteExecCall ["BIS_fnc_endMission",0];
};

 

Share this post


Link to post
Share on other sites
2 hours ago, Djavu said:

_grupoUnits = []; { if ((_x distance L_base) < 200) then { _grupoUnits pushback _x; }; } foreach allplayers;

->

private _grupoUnits = allPlayers select {(_x distance L_base) < 200};

 

2 hours ago, Djavu said:

remoteexec ["sidechat",[0,-2] select isdedicated];

->

remoteExec ["sidechat"];

Why are you putting these select isDedicated everywhere?

 

2 hours ago, Djavu said:

waituntil {sleep 1;int_base;};

are you sure int_base is set to true?

 

2 hours ago, Djavu said:

//works on debugger

Have you tried adding logging it to there to check if it works or not? Might very well be the waitUntil failing.

  • Thanks 1

Share this post


Link to post
Share on other sites
On 9/4/2019 at 10:14 AM, Dedmen said:
On 9/4/2019 at 7:52 AM, Djavu said:

waituntil {sleep 1;int_base;};

are you sure int_base is set to true?

 

On 9/4/2019 at 7:52 AM, Djavu said:

//works on debugger

Have you tried adding logging it to there to check if it works or not? Might very well be the waitUntil failing.

works perfectly when run on debug console
The point is that when compared to == 3 it works, when compared to> 0, it works. Only when compared to> = 3 does it not work in the script, only in the debug console.

 

On 9/4/2019 at 10:14 AM, Dedmen said:

remoteExec ["sidechat"];

Why are you putting these select isDedicated everywhere?

always used, never had problems, as quoted by REVO in the link on the subject.
https://community.bistudio.com/wiki/remoteExec

 

On 9/4/2019 at 7:52 AM, Djavu said:

_grupoUnits = []; { if ((_x distance L_base) < 200) then { _grupoUnits pushback _x; }; } foreach allplayers; _grupoUnits; _playercount = count _grupoUnits; [[west, "BASE"],format["There are %1 operators here in Base. We will continue this operation only if 3 of you cooperate.",_playercount]] remoteexec ["sidechat",[0,-2] select isdedicated]; waitUntil{!M_time}; if({_x distance port1 > 150}count _grupoUnits >= 3)then{ //works on debugger waituntil {sleep 1;int_base;}; sleep 5; "MySound" remoteExec [ "playSound",[0,-2] select isDedicated,false]; sleep 15; "MySound" remoteExec [ "playSound",[0,-2] select isDedicated,false]; }else{ m_falho = true; ["end1",false] remoteExecCall ["BIS_fnc_endMission",0]; };

In short, I need to check if 3 or more players from the matrix are more than 150 feet from port1 to proceed with code or finish the quest.

Share this post


Link to post
Share on other sites
20 hours ago, Djavu said:

always used, never had problems, as quoted by REVO in the link on the subject.
https://community.bistudio.com/wiki/remoteExec

It's a workaround for singleplayer, and only if you wanted to execute on -2 which you don't even want.

It makes no sense to be there.

 

20 hours ago, Djavu said:

does it not work in the script, only in the debug console.

That makes no sense. To repeat myself

 

On 9/4/2019 at 10:14 AM, Dedmen said:

Have you tried adding logging it to there to check if it works or not? Might very well be the waitUntil failing.

 

  • Thanks 1

Share this post


Link to post
Share on other sites
On 9/4/2019 at 5:14 AM, Dedmen said:
On 9/4/2019 at 2:52 AM, Djavu said:

//works on debugger

Have you tried adding logging it to there to check if it works or not? Might very well be the waitUntil failing.

I feel ashamed. It was my mistake. The variable m_falho has the value changed in another script, and I forgot publicvariable. In the debug console, I was setting it along with the code, so it worked there. Now it works perfectly. Thanks for listening.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×