Jump to content
Sign in to follow this  
ryansoper

Array issue - Why can I not select?!

Recommended Posts

I realise, I probably come across as a right knob, but I cannot for the life of me work out what I'm doing wrong.

I have an array, which contains the name of a load of markers:

_CSites =["CSite1", "CSite2", "CSite3", "CSite4", "CSite5", "CSite6", "CSite7", "CSite8", "CSite9", "CSite10"];

In order to test the selecting I have a the following:

_var = _CSites select 0;
hint format ["Pos:", _var];

So i'm expecting the hint in game to display "Pos: CSite1". However, all i see is "Pos: ".

What have I done?!

EDIT: Sigh, I am a knob, I hadn't formatted the hint correctly...

Edited by RyanSoper

Share this post


Link to post
Share on other sites
I realise, I probably come across as a right knob, but I cannot for the life of me work out what I'm doing wrong.

I have an array, which contains the name of a load of markers:

_CSites =["CSite1", "CSite2", "CSite3", "CSite4", "CSite5", "CSite6", "CSite7", "CSite8", "CSite9", "CSite10"];

In order to test the selecting I have a the following:

_var = _CSites select 0;
hint format ["Pos:", _var];

So i'm expecting the hint in game to display "Pos: CSite1". However, all i see is "Pos: ".

What have I done?!

EDIT: Sigh, I am a knob, I hadn't formatted the hint correctly...

_var = _CSites select 0;
hint format ["Pos: %1", _var];

Share this post


Link to post
Share on other sites

An easier way is

_string = "pos : " + _var;

hint _string;

Share this post


Link to post
Share on other sites
An easier way is

_string = "pos : " + _var;

hint _string;

This should only be korrect if _var is a String.

Having another type of variable one should use:

_string = "Pos: " + str(_var); or the former mentioned _string = format ["Pos: %1", _var]; (which for me seems to be the best way in most cases)

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  

×