ID:1802482
 
(See the best response by Ter13.)
I'm trying to set one obj's screen_loc to another obj's screen_loc, but have it one to the right.

var/obj/description/size1/K=new()
K.screen_loc=screen_loc
client.screen += K


Is there a way I can set K's screen_loc to src's screen_loc, but set it one to the right?

I don't want to have to hard code it in, because I'm doing this for hotslot descriptions, and I want it to just show a description when you move your mouse over the hotslot.

I think you misunderstood me.

What I want it to do, is when I move my mouse over the hotslot that has a technique on it, I want a 320x96 black box icon(that I have already made) to appear on your screen one spot to the right.

For the sake of clarity, I'll just make a quick example.

var/obj/object1/K = new()
K.screen_loc = "6,6"
client.screen += K

var/obj/object2/K2 = new()
K2.screen_loc = K.screen_loc
client.screen += K


I want K2's screen loc to be 7,6 without having to hard code it that way.

I tried doing K2.screen_loc = "[K.x+1],[K.y]", but it didn't work.
You'd have to parse the screen_loc and create a new one. But if you're doing that, I don't see why you wouldn't just write the screen_loc directly. Why copy it and change it when you can simply set it to whatever you need? Is there a reason it has to be dynamic?
I have 15 hotslots. If I were able to knock it out in one line, instead of using 15 if() statements to see which hotslot the technique is on then hard coding the screen_loc based on which hotslot the technique is on, I'd rather do that. Just thought there'd be a more efficient way
Make a function using string procs to parse the screen_loc then use each coordinate and offset to create the new screen_loc. I would show you an example but its fairly easy to do.
If I knew how to do that, I wouldn't be here asking. I'm aware that's what I need to do, just don't know how to. I know how to use offsets, and I know how to parse things. I don't know the name of the value of the X and Y coordinates for screen_locs
Seems like you're going about this backwards. If the screen_loc needs to be dynamic, have a proc that generates it for you based on the hotslot number. Under no circumstances would you ever need a big if/else thing or a switch to get this done.

For example:
proc/HotslotLoc(n)
return "[n],1"

You can make that as complex as you need to, even supporting grids or a more circular look, or anything you like.
I ended up using copytext() to pull the screen loc out, and converted it to a number. All I needed was the value for src's screen_loc so I could send it to K's screen_loc.

var/text = copytext("[screen_loc]",1,2)
var/text2 = copytext("[screen_loc]",5,7)
var/X = text2num(text)
var/Y = text2num(text2)
//
var/obj/descriptions/size/K = new()
O.description_size = K
K.icon_state = "[size]"
K.screen_loc = "[X + 1]:3,[Y - 1]:-1"
O.client.screen += K
Best response
You don't need that first copytext unless you use numbers in your map element's id and use multiple maps.

text2num() will return the value of the first number it finds in the sequence.

Assuming a value of "4,8"

text2num(screen_loc) will return 4
text2num(copytext(screen_loc,2)) will return 8

Your implementation is brittle, though. I agree with Lummox. Don't bother copying the screen location from text at all. Store the x/y screen coordinates in variables and abstract the screen_loc setter behind a function.
Alright. Thank you, I do appreciate the help.
For the record, this is what I wanted:
http://gyazo.com/5ae7ac4555490fcdcc319f5dee8f890b

And when I move to a different hotslot:
http://gyazo.com/eaebf5b53627f9217c303beee8ffd111

It's not finished, obviously. I'll add more graphics and stuff to it. Just wanted to get this down.
Why make it a separate screen object at all? Why not just add the image of the attack in the hotslot as an overlay, and then set a reference to an attack object on the hotslot?
Did I just go about it a harder way?
Yup.
Yeah, I tend to do that.