Jump to content
Sign in to follow this  
Somerville

Displaying variable in hint

Recommended Posts

Hi,

In my mission, you can request permission to fly a chopper. Once you've done this, a senior officer on the map has the action to check if you're, in effect, licenced to fly.

The variables is "P6F" (Player 6 Fly, basically). Now, once this has been approved/denied, the senior officer walks up to the player, and hits "Check status". This displays a hint, along the lines of:

"Player: [Name]

Fly? [Yes/No]"

This is determined in the script, liccheck.sqs:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

? P6F : Player6Fly = "Yes";

? (!P6F) : Player6Fly = "No";

hint format ["Player: %1 \nFly? %2", name unit6, Player6Fly]

That's just basic - I'm at work at the moment, so I can't get more detailed than that. Anyway, it's always saying "No". I've tested by putting down a trigger that turns P6F to true, but it still just says "No" for Status. How come this is so?

Share this post


Link to post
Share on other sites

Try structuring the code slightly differently:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

if P6F then {Player6Fly = "Yes";} else {Player6Fly = "No";};

Share this post


Link to post
Share on other sites

That hasn't worked.

What I did to test it, was to put down a trigger set to BLUFOR present, with Player6Fly=TRUE; in the activation line, with 'this' as the condition.

It just doesn't seem to register with ArmA. If I change it in init.sqs, then it automatically comes up as yes in the hint. But if it's changed by any other script, it just doesn't work. The spelling is correct, as it has been copied then pasted from the init.sqs to ensure this.

Oh my God this is doing my NUT in ><

Share this post


Link to post
Share on other sites

Indeed can some expert or something come help us with this its very important.

Thankyou smile_o.gif

Share this post


Link to post
Share on other sites

Test this, it worked

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

?P6F == 1: _1 = "yes"

?P6F == 0: _1 = "no"

hint format ["Player: %1 \nFly? %2", name player,_1]

Just depends if you want "Player6Fly" a global var or not

Share this post


Link to post
Share on other sites

That didn't work, it displayed an error in the top-left of the screen to do with using boolean data.

The problem I believe is, as simply as can be put, this:

1) Player gets credentials to fly. Variable P6F in that script is set to true as follows:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">P6F=TRUE;

2) Senior officer checks credentials. Script for this checks to see if P6F is true, in order to determine whether the end value is "Yes" or "No". See earlier posts to see an example of the script used.

3) The script is returning the value as No at all times, only saying "Yes" if I change the value to true in init.sqs.

Why does ArmA not like being told a variable is true?

Share this post


Link to post
Share on other sites
Quote[/b] ]Senior officer checks credentials. Script for this checks to see if P6F is true, in order to determine whether the end value is "Yes" or "No". See earlier posts to see an example of the script used.

This is for a multi player mission?

Quote[/b] ]Why does ArmA not like being told a variable is true?

If it's a Multi Player mission, you have to broadcast the variable with publicVariable once you change it from the default state. If it's not MP then make sure your reaching the point in the code that actualy does changes it.

Share this post


Link to post
Share on other sites

Oki i have just leanrt this.. ok This is my example.

Target.sqs

Quote[/b] ]

showresult = false

Publicvariable "showresult"

TargetHits = 0

publicVariable "TargetHits"

Targetmiss = 0

publicVariable "Targetmiss"

targetcount = 0

publicVariable "Targetcount"

#Time

showhint = false

Publicvariable "Showhint"

~0.25

?(getdammage _target > 0.1) : goto "hit"

timecount = timecount + 0.25

?timecount < time : goto "time"

_target setdammage 1

Targetmiss = Targetmiss + 1

Publicvariable "Targetmiss"

~1

showhint = true

Publicvariable "Showhint"

goto "next"

#Hit

_target setdammage 1

TargetHits = Targethits + 1

Publicvariable "TargetHits"

~1

showhint = true

Publicvariable "Showhint"

goto "next"

#next

~2

deletevehicle _target

~2

?localtargetcounter >= targets : showhint = true ; Publicvariable "Showhint" ; goto "end"

goto "loop"

#end

testinprogress = false

Publicvariable "testinprogress"

showresult = true

Publicvariable "showresult"

testnumber1 = 0

Publicvariable "testnumber1"

testnumber2 = 0

Publicvariable "testnumber2"

Showhint.sqs

Quote[/b] ]

#hint

hint format ["Currently:\n%5\nTarget %6 of %7\n\nHits: %1\nMiss: %2\n\nHit ratio: %4 percent",TargetHits,Targetmiss,targetcount,percent,testmessage,testnumber1,testnumber

2]

showhint = false

Publicvariable "Showhint"

exit

Look this over and see how it works maybe it will help i will also look at your script and see what i can do.

Share this post


Link to post
Share on other sites
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

? (!P6F) : Player6Fly = "No";

? P6F : Player6Fly = "Yes";

hint format ["Player: %1 \nFly? %2", name unit6, Player6Fly]

With this i think its how it works:

Quote[/b] ]

? P6F : Player6Fly = "Yes";

Publicvariable "Player6Fly"

? (!P6F) : Player6Fly = "No";

Publicvariable "Player6Fly"

hint format ["Player: %1 \nFly? %2", name unit6, Player6Fly]

Share this post


Link to post
Share on other sites

I could imagine the problem is the variable P6F that got not sent. Do you use publicVariable on it when setting it to true?

Is there a reason why you dublicate information with P6F and Player6Fly?

else you can also try the code below

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

hint format ["Player: %1 \nisFlying: %2", name unit6, P6F]

Hope it helps

Share this post


Link to post
Share on other sites

I set P6F to true, then put PublicVariable "P6F".

For some reason, it is only with this variable it does not work. However, with other variables, they display in the hint.

Arrrghh. My brain hurts.

Share this post


Link to post
Share on other sites

Well in that case you need to provide a bit more information.

Do you test the whole thing in the single player editor, the multiplayer editor or even directly on a dedicated server?

Can you reduce your testmission down to the point that it shows only the P6F never turns true issue?

Share this post


Link to post
Share on other sites

Tell us what's returned when you do this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

player sideChat format["P6F: %1", P6F];

? P6F : Player6Fly = "Yes";

? (!P6F) : Player6Fly = "No";

player sideChat format["Player6Fly: %1", Player6Fly];

hint format ["Player: %1 \nFly? %2", name unit6, Player6Fly]

If the first sideChat returns a scalar bool array message, then you haven't initialised P6F and the test is failing every time due to that. In fact, now that I think of it, that's most definatly the most likely cause.

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  

×