ID:163010
 
Ok, I have a var, called Locations="100,200,3", now, I have an obj, called A, and I need to somehow place A at 100,200,3 using only the info in the Locations var, something like A.loc=locate(Locations), although that example doesnt work for some reason, is there any way you know of to do this? And yes it -has- to be done with a text string.
Why does it have to be done with a text string? :/

You could either make three seperate vars, or use a locate() in the var.
Dragonn wrote:
Ok, I have a var, called Locations="100,200,3", now, I have an obj, called A, and I need to somehow place A at 100,200,3 using only the info in the Locations var, something like A.loc=locate(Locations), although that example doesnt work for some reason, is there any way you know of to do this? And yes it -has- to be done with a text string.

The locate() procedure can only get x,y,z values as numerical arguments. What this means is you need to find a way to convert your string of coordinates into numerical values. But before you do that you need to separate the values in the string.

http://developer.byond.com/hub/Deadron/TextHandling is a good resource for this job. Right after you include the lib into your project, you use the dd_text2list(text, separator) function in the lib.

var/Coord = "100,200,3"
var/L[] = dd_text2list(Coord, ",")
// Now L contains 3 text strings each containing are x,y, and z values.
var/numlist[] = stringList2numList(L)
// Converts string list into a number list.
A.loc = locate(numlist[1],numlist[2],numlist[3])

proc/stringList2numList(list/stringlist)
var/numlist[stringlist.len]
// Creates a numlist same size as string list
var/i
for(i=1;i<=numlist.len;i++)
numlist[i] = text2num(stringlist[i])
return numlist

I'm pretty sure this is not the best code to use in your own code. It's just an example of how it could be done. I hope it provides some insight.
In response to Kaiochao2536
Actually no I cant, because the reason I need it is so I can save every thing on the map as text then restore it later from the text. But that other guys response probably solved it.
In response to Dragonn
The map IS text.