ID:147128
 
i dunno if there is a cleaner way to do this but if there is can you please tell me?
        if(usr.obs==1)
world<<"<font color=yellow>{Obsrever}<font color=black>[src]: [msg]"
if(usr.alien==1)
world<<"<font color=purple>[src]: [msg]"
if(usr.soldier==1)
world<<"<fontcolor=green>[src]: [msg]"
else
world<<"[src]: [msg]"

it says inconsistant indetation to the world << but i think its just that theres ot many ifs..
well this is your halo game right? any hoot...
your first thing is actually forward one space and there is no real way to simplify that except to make a variable of the fontcolor in html and make it so font color = the font color variable and the variable could be assigned when you pick a race!
thnx but from that i only got....
mob
verb
Say(msg as text)
if(obs)
world<<"<font color=yellow>{Obsrever}<font color=black>[src]: [msg]"
if(alien)
world<<"<font color=purple>[src]: [msg]"
if(soldier)
world<<"<fontcolor=green>[src]: [msg]"
else
world<<"[src]: [msg]"

and yes its for my halo game v2,when i say somthing it comes out as if else...
In response to CodingSkillz2
Thats not what the article said, just fix your identation on the solder if's and make it else if(soldier)
In response to CodingSkillz2
mob
verb
Say(msg as text)
if(obs)
world<<"<font color=yellow>{Obsrever}<font color=black>[src]: [msg]"
if(alien)
world<<"<font color=purple>[src]: [msg]"
else if(soldier)
world<<"<fontcolor=green>[src]: [msg]"
else
world<<"[src]: [msg]"
somin like that? or...
mob
verb
Say(msg as text)
if(obs)
world<<"<font color=yellow>{Obsrever}<font color=black>[src]: [msg]"
if(alien)
world<<"<font color=purple>[src]: [msg]"
else if(soldier)
world<<"<fontcolor=green>[src]: [msg]"
else
world<<"[src]: [msg]"

or mabe i'm just a noob altogether? o.o

The first line is indented too far. By the look of the code, you are doing things very ineffeciently. Consider this:

Can a player be both an observer, an alien and a soldier? If not, theres no reason to have them as 3 variables. Even if they could, there isn't (That involves bit shifting, thats another topic entirely).

You can set a variable to a number, a string, a typepath, a list or a reference. There's no reason to do as you have. Combine the 3 into one, and have 3 different values to check for. Example:
var/const
TYPE_ALIEN = 1
TYPE_SOLDIER = 2
TYPE_OBSERVER = 3

proc/type_to_color(mob/M)
switch(M.game_mode)
if(TYPE_ALIEN) return "<font color=purple>"
if(TYPE_SOLDIER) return "<font color=green>"
if(TYPE_OBSERVER) return "<font color=yellow>(Observer)</font><font color=black>"


Then you can change your above example to:
world << "[type_to_color(usr)][src]</font>: [msg]"


im out of time now, going to shop groceries, so hope that helped :)

[Edit: Im back now. You used both src and usr in your own example, and im wondering where you are calling it from. I'd stick to one or the other in any case, and in some cases usr is a bad thing.]
In response to Alathon
I see much clear now but the only part i dont get of the code and thats an error..is the switch(M.game_mode)
i under stand m just not the game mode.
In response to CodingSkillz2
CodingSkillz2 wrote:
I see much clear now but the only part i dont get of the code and thats an error..is the switch(M.game_mode)
i under stand m just not the game mode.

game_mode would be a variable you need to declare under /mob, to store what the player is. Set it when they enter the game, create their character or whatever based on their choice.

I made a proc to convert a const to color, you could make a proc to convert a choice to a const for setting their "mode":
proc/mode_to_const(mode)
switch(mode)
if("alien") return TYPE_ALIEN
if("soldier") return TYPE_SOLDIER
if("observer") return TYPE_OBSERVER
else return 0 // Invalid mode
In response to Alathon
umm...so basically when they click wut icon they want to be i add the var =1 ?

Ps:i know i'm hard headed just try to put up with me o_o||
In response to CodingSkillz2
CodingSkillz2 wrote:
umm...so basically when they click wut icon they want to be i add the var =1 ?

Ps:i know i'm hard headed just try to put up with me o_o||


You are not hard headed but just need to learn the basics.

--Goz