ID:168967
 
How can I make it so that I take one hud object of an unknown location and move it to another location based on its current location? (i.e. move it 3 spaces north)

I tried "O.screen_loc += "3,0"" but that doesn't work with text :P The DM Referance doesnt' seem to help me this time :'(



P.S. Maybe I should have asked this instead, but I can do this right? :P
Make vars recording the sx and sy.
In response to Ol' Yeller
1) Wow that really was fast

2) huh?

:( I feel stupid
In response to Cowdude
_>
Sorry, I was in a hurry.
Make vars record the current screen_x and screen_y, and change them accordingly.
In response to Ol' Yeller
going to sleep like I said? :P
In response to Cowdude
_> Yessss..
In response to Ol' Yeller
obj/hud/hudobj1
icon = 'Test.dmi'
screen_loc = "2,2"
screen_x = 2
screen_y = 2

obj/hud/var
screen_x = 0
screen_y = 0

mob/verb/Moveit(var/obj/hud/O, A as num, B as num)
O = src.firstobj
O.screen_x += A
O.screen_y += B
//Insert some if() to make sure it can't go off the screen//
O.screen_loc = "[O.screen_x],[O.screen_y]"

mob/Login()
..()
src.firstobj = new /obj/hud/hudobj1
src.client.screen += src.firstobj

Like this? :D
Took me 5-10 minutes to figure out what he mean >_> I feel stupid again. :(

Anyway, what I'm using this is to try and put chat on the map as HUD because I'm trying to see how much of the text box I can avoid using ("Who" is in browser, for example)
In response to Cowdude
Just an idea you might not have thought of. You can easily make a chat system that uses statpanels. They're actually really good for it.
You can do all sorts of neat stuff (like a statpanel per chat channel, one for battle output, etc).

I wrote a demo doing this once, but I can't seem to find it. I might write up a new version of it and put it up later.
Basically here's what to do:
var/global/list/chatChannels[0]

chatChannel
var
name
list/messages[0]
proc
addMessage(var/msg)
src.messages += msg

world
New()
. = ..()
var/chatChannel/cC = new()
cC.name = "Channel One"
global.chatChannels += cC

cC = new()
cC.name = "Channel Two"
global.chatChannels += cC


mob
Stat()
for(var/chatChannel/cC in global.chatChannels)
statpanel("[cC.name]",cC.messages)

var/chatChannel/currentChannel

verb
setChannel()
src.currentChannel = input("Select a chat channel to use") in global.chatChannels
say(var/msg as text)
if(src.currentChannel)
src.currentChannel.addMessage("[src.name]: [msg]")


Of course there are downsides.
-You can't format the statpanel as well as the text area.
-After a certian amount of messages you'll need to start triming the list when adding new messages.
-You'll have to reverse the order of the lists so that new messages go to the top of the list.


All in all I find this is a really good technique. If in v4.0 you can customize the statpanels more, it'll definantly be my technique of choice.