Jump to content
Sign in to follow this  
eagledude4

Issue with formatting variable "type string expected object"

Recommended Posts

I have a marker called SabinaStation, and an npc called Sabina. _Sel is defined as "Sabina".

_Sel = _this select 0;
_Marker = format ["%1Station", _Sel];

player setpos [getMarkerPos _Marker select 0, getMarkerPos _Marker select 1, 0];
player setDir (getDir _Sel);

How do I format the _Marker variable to not use the quotes? I tried call compile format as well. Maybe I need to use a cba function?

Edited by eagledude4

Share this post


Link to post
Share on other sites

A guess would be that you're trying to getDir for "Sabina" when you only want Sabina.

So pass "Sabina" as Sabina instead.

Share this post


Link to post
Share on other sites

I would need to pass 2 parameters for each destination then, one without the quotes and one with.

For the sake of using the least amount of code as possible, I'd like to find a way to format "Sabina" and remove the quotes.

EDIT: See post 5 for solution

Edited by eagledude4

Share this post


Link to post
Share on other sites

That should not be needed.

TAG_testFunc = {
_Sel = _this select 0; 
_Marker = format ["%1Station", _Sel]; 
player setpos [getMarkerPos _Marker select 0, getMarkerPos _Marker select 1, 0]; 
player setDir (getDir _Sel);

}; 

[player] call TAG_testFunc;

Teleported me to the marker without any problems.

Share this post


Link to post
Share on other sites

Ya, I was putting Sabina in quotes in the array before. Removing them solved the issue. So in essence did the opposite of what I was trying to do initally.

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  

×