Jump to content
Sign in to follow this  
1para{god-father}

Simple Hint on Dedi server !

Recommended Posts

How can i get a Hint to work on a dedi server, I am trying to get a timer to show on each screen, but with no luck

This works on Hosted when i test but NOT on Dedi , can someone advise me why this would be ?

///Just test for now////
_who="Test";
_min=5;
_sec=30;

[nil,nil,rHINT,hint (format["%3 WIN %1:%2",_min,_sec,_who])] call RE;

How can i get a hint to work on a dedi box ?

Share this post


Link to post
Share on other sites

Not sure why, the documentation is poor on MPF.

Tried these examples?:

_str = format["%1",_var];
[nil,nil,rHINT,_str] call RE;

_str = parseText format["%1",_var];
[nil,nil,rHINT,_str] call RE;

[nil,nil,rSPAWN,hint (format["%1",_var])] call RE;

Share this post


Link to post
Share on other sites
Not sure why, the documentation is poor on MPF.

Tried these examples?:

_str = format["%1",_var];
[nil,nil,rHINT,_str] call RE;

_str = parseText format["%1",_var];
[nil,nil,rHINT,_str] call RE;

[nil,nil,rSPAWN,hint (format["%1",_var])] call RE;

OK so ....

This works on Dedi

_str="This is a test";
[nil,nil,rHINT,_str] call RE;

This does not work on dedi

_var=30;
[nil,nil,rSPAWN,hint (format["%1",_var])] call RE;

Any idea how I can get numbers to work on the dedi as it is for a countdown timer that i need to show on All clients. ideal run on the server not on each client

Thanks

Share this post


Link to post
Share on other sites
OK so ....

This does not work on dedi

_var=30;
[nil,nil,rSPAWN,hint (format["%1",_var])] call RE;

Any idea how I can get numbers to work on the dedi as it is for a countdown timer that i need to show on All clients. ideal run on the server not on each client

Thanks

Ahh I get it now, problem is you are feeding it a variable. Hints require a string.

http://community.bistudio.com/wiki/String

http://community.bistudio.com/wiki/Variables

Can't think of a good example but the str command can be used to convert the variable into a string

http://community.bistudio.com/wiki/str

edit: My thought would be this:

if (!isServer) exitWith {};
_var = 0;

while {_var < 10} do {
_var = _var +1;
_str = str _var;
[nil,nil,rSPAWN,hint (format["%1",_str])] call RE;
if (_var == 10) exitwith {_var = 0};
sleep 1;
};

Untested - any good?

Edited by PELHAM

Share this post


Link to post
Share on other sites

Yep that cracked it :)

Thanks !!!

---------- Post added at 07:49 PM ---------- Previous post was at 06:27 PM ----------

OK Another little issue :)

how can I stop the Beep now each time it comes up ?

[nil,nil,rHINT,(format["%3 WIN %1:%2",_min,_sec,_who])] call RE;

Share this post


Link to post
Share on other sites

Just add in hintSilent?:

[nil,nil,rSPAWN,hintSilent (format["%1",_str])] call RE;
//or
[nil,nil,rHINT,hintSilent (format["%1",_str])] call RE;

Share this post


Link to post
Share on other sites
Just add in hintSilent?:

[nil,nil,rSPAWN,hintSilent (format["%1",_str])] call RE;
//or
[nil,nil,rHINT,hintSilent (format["%1",_str])] call RE;

Now you would have thought it would be that easy! But alas not as soon as I put in the hintSilent it no longer works on the dedi , but it works when I test and host !!

What is that all about ?! also "rSPAWN " - what does that mean , and BTW that does not work with or without Hintsilent so not sure that is DEDI compatable.

Any other suggestions ?

Share this post


Link to post
Share on other sites

Lets go back to that previous example then:

_input = hintSilent format["%1",_str];
[nil,nil,rHINT,_input] call RE;

That works silently in single player.

Sorry can only test this in single player - not got my cfg set up right at the moment.

Share this post


Link to post
Share on other sites

Make your own network command for it using PVEH's....

In your init.sqf....

//*************************************************************
//Network hintSilent system PVEH
//*************************************************************
if (isNil "MyNetHintSilent") then {
MyNetHintSilent = 0;
};

"MyNetHintSilent" addPublicVariableEventHandler {
private ["_hint"];
_hint = _this select 1;
hintSilent format ["Time Left: %1 seconds",_hint];
};

Then to use it....

if (isServer) then {
for "_i" from 100 to 1 step -1 do {
	MyNetHintSilent = _i;
	publicVariable "MyNetHintSilent";
	sleep 1;
};
};

Works on Dedicated server.

This hints silently "Time Left: x seconds" on clients machines.

Edited by twirly
Correction to code

Share this post


Link to post
Share on other sites

You also might want to look into using BIS_fnc_dynamicText instead. It will show to everyone connected. Might be much simpler.

[text,x coord,y coord,duration,fade-in time,delta y,resource layer] call BIS_fnc_dynamicText

["<t size='3'>" + "Hello World" + "</t>",0.5750,0.2178,10,-1,1,3010] spawn BIS_fnc_dynamicText;

Share this post


Link to post
Share on other sites
Make your own network command for it using PVEH's....

In your init.sqf....

//*************************************************************
//Network hintSilent system PVEH
//*************************************************************
if (isNil "MyNetHintSilent") then {
MyNetHintSilent = 0;
};

"MyNetHintSilent" addPublicVariableEventHandler {
private ["_hint"];
_hint = _this select 1;
hintSilent format ["Time Left: %1 seconds",_hint];
};

Then to use it....

if (isServer) then {
for "_i" from 100 to 1 step -1 do {
	MyNetHintSilent = _i;
	publicVariable "MyNetHintSilent";
	sleep 1;
};
};

Works on Dedicated server.

This hints silently "Time Left: x seconds" on clients machines.

OK Still having an issue with this it works great on HOST but NOT on DEDI, never thought it would be so hard to get a silent timer working on a dedi.

INI

if (isNil "MyNetHintSilent") then {
MyNetHintSilent = 0;
};

"MyNetHintSilent" addPublicVariableEventHandler {
hintSilent format ["%1:%2",_min,_sec];
};

if (!isServer) exitWith {};
private ["_t","_min","_sec"];

_t = _this * 60;

while {_t > 0 && psholdtimer} do {
 _min = floor (_t / 60);
 _sec = floor (_t mod 60);

 _min = (if (_min <= 9) then {"0"} else {""}) + str _min;
 _sec = (if (_sec <= 9) then {"0"} else {""}) + str _sec;

publicVariable "MyNetHintSilent";

 _t = _t - 1;
 sleep 1;
};

Share this post


Link to post
Share on other sites

Found a couple things that were not quite right....try this...

init.sqf....

if (isNil "MyNetHintSilent") then {
MyNetHintSilent = [0,0];
};

"MyNetHintSilent" addPublicVariableEventHandler {
private ["_hint","_min","_sec"];
_hint = _this select 1;
_min = _hint select 0;
_sec = _hint select 1;
hintSilent format ["%1:%2",_min,_sec];
};

timer.sqf....

if (!isServer) exitWith {};
private ["_t","_min","_sec"];
_t = (_this select 0) * 60;
while {_t > 0 && psholdtimer} do {
 	_min = floor (_t / 60);
 	_sec = floor (_t mod 60);
 	_min = (if (_min <= 9) then {"0"} else {""}) + str _min;
 	_sec = (if (_sec <= 9) then {"0"} else {""}) + str _sec;
MyNetHintSilent = [_min,_sec];
//for SP and COOP
if (not isDedicated) then {
	hintSilent format ["%1:%2",_min,_sec];
};
publicVariable "MyNetHintSilent";
 	_t = _t - 1;
 	sleep 1;
};

From my limited testing seems to work everywhere.... SP, Dedi and COOP.

EDIT: If you need me to post my little test mission....just scream!

Edited by twirly
Added stuff

Share this post


Link to post
Share on other sites

OK thought it had worked but played on Dedi server last night and no timer :(

It all works great on Host but still not on a dedi server ! any other suggestions ?

Share this post


Link to post
Share on other sites

Quick example using MP Framework:

init.sqf

if (isServer) then
{
while { true } do
{
[nil, nil, rSPAWN, [], { hintSilent "This hint will show up in every connected machine...every 5 seconds..." }] call RE;
sleep 5;
};
};

Although, since you are using a timer, broadcasting the hint every second or every 5 seconds is simply poor optimization.

You can instead, call a script in ALL machines ONCE, and do your stuff in there.

[nil, nil, rEXECVM, "my_timer_script.sqf", []] call RE; //This will execute my_timer_script.sqf in all connected machines.

Share this post


Link to post
Share on other sites

Ahhh that is how i get the Hint to be silent, that one works now , Happy again ! and thanks for the advice !

[nil, nil, rSPAWN, [], { hintSilent "This hint will show up in every connected machine...every 5 seconds..." }] call RE;

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
Sign in to follow this  

×