ID:1980878
 
(See the best response by Kaiochao.)
Code:
client
perspective=EDGE_PERSPECTIVE|EYE_PERSPECTIVE
show_popup_menus=1


MouseMove(object,location,control,params)
UpdateMouse(object,location,control,params)
proc/UpdateMouse(object,location,control,params)
var/par=params2list(params)
var/pos = par["screen-loc"]


if(!pos) return

var/comma = findtext(pos, ",")
var/colon = findtext(pos, ":")

if(comma < 1) return
if(colon < 1) return

var/tx = text2num(copytext(pos, 1, colon))
var/px = text2num(copytext(pos, colon + 1, comma))

colon = findtext(pos, ":", comma)

if(colon < 1) return

var/ty = text2num(copytext(pos, comma + 1, colon))
var/py = text2num(copytext(pos, colon + 1))

usr.Mouse.screen_loc = "[tx]:[px - 16],[ty]:[py - 16]"


Problem description:

Hallo, i try to make screen cursor fo 2 maps, and this is code. It's work but only if i use one(defualt map). My proble is, i use 2 maps and screen_loc format for 2nd is "Mapname:1,2". I know what is problem but i have no idea how to fix it... :(

Best response
My current mouse screen-loc parser:
// parses screen-loc in form: 
// "[tx]:[px],[ty]:[py]" or
// "[map_id]:[tx]:[px],[ty]:[py]"

// input
var s = // the given "screen-loc" parameter

// outputs
var map_id = ":map"
if(isnull(text2num(s))) // doesn't start with a number -> starts with map ID (assuming map ID doesn't start with a number)
var colon = findtext(s, ":")
map_id = copytext(s, colon)
s = copytext(s, colon + 1)
var tx = text2num(s); s = copytext(s, 2 + length("[tx]"))
var px = text2num(s); s = copytext(s, 2 + length("[px]"))
var ty = text2num(s); s = copytext(s, 2 + length("[ty]"))
var py = text2num(s)