ID:177219
 
ok so here is what I want to do. every player in my game has a rank i.e captain, admiral, cadet. what I want to do is have that rank show when the people chat.

admiral treasurecat: like this.

this is what I have

mob/verb/say (msg as text)
world << "[usr]: [msg]"

I was trying to think of the best way to do this right now the rank is being treated as an object and being held in the inventory. If there was a way to list that object in the text

mob/verb/say (msg as text)
var/contents/object/rank = rank
world << "[rank][usr]: [msg]"

I know this wont quite work but maybe you have a better ideah of what im trying to do.

does anyone have any suggestions on how I could get this done?

Maybe by setting it to a simple var?


mob
var
rank

mob
verb
say(T as text)
world << "[rank] [usr]: [T]"
Assuming all ranks are of type Rank with a parent_type of /obj (which you should do like this:

Rank
parent_type = /obj
Private
Private_First_Class
//etc

), then you should do...

mob/verb/say(msg as text)
if(length(msg) > 600) return
var/Rank/R = locate() in usr
world << "[R.name] [usr]: [html_encode(msg)]"

I made a few changes, which all games should have: bolding of the name, html_encoding, and spam protection.
In response to Nadrew
yes I thought about that too but im having problems with the var as a text string
example

mob/var/rank = cadet

I havnt gotten this to work it wont let me set the rank vaule to cadet. what do I need to do?
In response to Treasurecat
Treasurecat wrote:
yes I thought about that too but im having problems with the var as a text string
example

mob/var/rank = cadet

I havnt gotten this to work it wont let me set the rank vaule to cadet. what do I need to do?
mob/var/rank="cadet"


~ Kyle