ingame message printing... --> [gameText]
Posted: Sun Jan 16, 2011 8:51 pm
Here I am, again!
bringing to you a somewhat useful function, It has a complex usage but it also supports all kinds of ingame message printing I can think of!
Behold.... gameText!
the following kinds are available: SAY, ZONE, YELL, WORLD, GUILD, RAID, PARTY, WHISPER, CHANNEL, SYSTEM, WARNING, SYSCHAT, MSG
note: unlike all other args, kind must be passed in caps.
Bear in mind this was designed for both simplicity AND functionality, so I'll provide examples from the simplest to msot functional.
writes the message "Hello Word" in the ingame chat window in message regular color, standard is a dark yellow. (Same as gameText("Hello World","MSG")
will whisper "Goodbye Cruel World" to "[GM]Bothater". At the moment the "CHANNEL" kind isn't working but usage is similar will write in private channel 1: "Mass Suicide Anyone?". The channel arg is only use in these 2 cases.
will write "This is a sad day!" in the zone channel in gold color. the color argument takes a color name from the local colors table or a color hex string. Currently the following colors are indexed:
if you want gray for example, you have to pass "cccccc" as color and not "gray" because "gray" isn't on this table, if you do so the message will be written with code errors. You can use the color argument with ANY kind of message but if you don't it'll use default color.
You can also use Item Links inside the message with ANY kind of message! at the moment it is limited to 1 link, to do so just include "ITEM" in your message:will write "My armor is sweet!--> [God's Breasts] right?" in red to world chat (YELL and WORLD are both the same kind) the text will be red but the item has its own color. Also the item argument can search an item in your inventory by name or ID or you can just pass a CItem object to it:will also work(as proof of concept in this case).
RAID and PARTY kinds are the same also and are used like ZONE or WORLD.
The SYSTEM and WARNING print an onscreen message, unlike the other kinds the message is displayed in the middle of the screen instead of chat box. work with different colors and itemlink and the default to yellow and red colors respectively.
The SYSCHAT kind prints a system-like message to the chat box, as far as I can tell It is only different from MSG in it's default color, which is orange.
Enjoy!!!
EDIT: if anyone has any suggestion as for CHANNEL problem I'm glad to take it, I think we have to be channel managers :S
bringing to you a somewhat useful function, It has a complex usage but it also supports all kinds of ingame message printing I can think of!
Behold.... gameText!
Code: Select all
USAGE: gameText(msg[,kind,channel,color,item])
note: unlike all other args, kind must be passed in caps.
Bear in mind this was designed for both simplicity AND functionality, so I'll provide examples from the simplest to msot functional.
Code: Select all
gameText("Hello World")
Code: Select all
gameText("Goodbye Cruel World","WHISPER","[GM]Bothater")
Code: Select all
gameText("Mass Suicide Anyone?","CHANNEL",1)
Code: Select all
gameText("This is a sad day!","ZONE",nil,"gold")
Code: Select all
colors = {
white = "ffffff",
green = "00ff00",
blue = "0072bc",
purple = "a864a8",
orange = "f68e56",
gold = "a37d50",
yellow = "ffff00",
red = "ff0000",
};
You can also use Item Links inside the message with ANY kind of message! at the moment it is limited to 1 link, to do so just include "ITEM" in your message:
Code: Select all
gameText("My armor is sweet!--> ITEM right?","WORLD",nil,"red","God's Breasts")
Code: Select all
gameText("My armor is sweet!--> ITEM right?","WORLD",nil,"red",inventory:findItem("God's Breasts"))
RAID and PARTY kinds are the same also and are used like ZONE or WORLD.
The SYSTEM and WARNING print an onscreen message, unlike the other kinds the message is displayed in the middle of the screen instead of chat box. work with different colors and itemlink and the default to yellow and red colors respectively.
The SYSCHAT kind prints a system-like message to the chat box, as far as I can tell It is only different from MSG in it's default color, which is orange.
Enjoy!!!
EDIT: if anyone has any suggestion as for CHANNEL problem I'm glad to take it, I think we have to be channel managers :S