ID:264247
 
Code:
mob
verb

Chat()
set category = "Commands"
if(!usr.cantalk) return
if(usr.muted) return
if(!usr.firing)
usr.firing = 1
var/ms = input("What would you like to say to the people in your view?","View Chat")as text|null
if(!ms) return
var/msg = copytext(ms,1,200)
for(var/mob/M in oview(usr)) M << "<b><font size=1><font color=red>{<font color=#FF7777>View Chat<font color=red>} [usr] says: <font color=silver>[html_encode(msg)]"
sleep(8)
usr.firing = 0
else return


Problem description:

I type in what I want to say (Which means the cantalk/muted if statements are not the problem), but then when I pres OK nothing happens.


Code:
turf/HairSelect
icon = 'preview.dmi'
Ichigo/icon_state = "ichigo"
Click()
switch(alert("You want this hair?","Hair Select","Yes","No"))
if("Yes")
usr.hair = "ichigo"
usr.overlays += /obj/hair/ichigohair
world << "<font size=1><b><font color=silver>BFHH: <font color=white>[usr.name] has logged in."
usr.loc = locate(300,300,1)
usr.online = 1
usr.cansave = 1
usr.cantalk = 1
usr.OOC = 1
usr.Bonus()



obj/hair
ichigohair
icon = 'Ichigo Hair.dmi'


Problem Description:

I choose the hair style, then I login, but I don't get the hair style. I'm still bald.
turf/HairSelect
icon = 'preview.dmi'
Ichigo/icon_state = "ichigo"
Click()
switch(alert("You want this hair?","Hair Select","Yes","No"))
if("Yes")
usr.hair = "ichigo"
usr.overlays += new/obj/hair/ichigohair // You needed to add a "new" to it or it wouldn't add no hair.
world << "<font size=1><b><font color=silver>BFHH: <font color=white>[usr.name] has logged in."
usr.loc = locate(300,300,1)
usr.online = 1
usr.cansave = 1
usr.cantalk = 1
usr.OOC = 1
usr.Bonus()



obj/hair
ichigohair
icon = 'Ichigo Hair.dmi'
mob
verb

Chat()
set category = "Commands"
if(usr.cantalk == 0)
return
if(usr.muted == 1)
return
if(usr.firing == 0)
usr.firing = 1
var/ms = input("What would you like to say to the people in your view?","View Chat")as text|null
if(!ms) return
var/msg = copytext(ms,1,200)
view(usr) << "<b><font size=1><font color=red>{<font color=#FF7777>View Chat<font color=red>} [usr] says: <font color=silver>[html_encode(msg)]"
usr << "<b><font size=1><font color=red>{<font color=#FF7777>View Chat<font color=red>} [usr] says: <font color=silver>[html_encode(msg)]"
sleep(8)
usr.firing = 0
else return

Use this code it should work perfectly.
In response to Gizhy Games
Gizhy Games wrote:
> mob
> verb
>
> Chat()
> set category = "Commands"
> if(usr.cantalk == 0)
> return
> if(usr.muted == 1)
> return
> if(usr.firing == 0)
> usr.firing = 1
> var/ms = input("What would you like to say to the people in your view?","View Chat")as text|null
> if(!ms) return
> var/msg = copytext(ms,1,200)
> view(usr) << "<b><font size=1><font color=red>{<font color=#FF7777>View Chat<font color=red>} [usr] says: <font color=silver>[html_encode(msg)]"
> usr << "<b><font size=1><font color=red>{<font color=#FF7777>View Chat<font color=red>} [usr] says: <font color=silver>[html_encode(msg)]"
> sleep(8)
> usr.firing = 0
> else return
>

Use this code it should work perfectly.

You don't need == 0, you use !. And you don't need == 1 if the value can't get higher. I have use the for() because when my game gets closer to opening, I will have ignore commands, and stuff. Besies, that couldn't possibly be the reason why it's not working.

And adding new to the overlays += code didn't work.
In response to Xx Ohone xX
I only added the ==1 & ==0 because simply that's the way I code.
In response to Gizhy Games
It was something to do with the for() proc in the chat verb, not quite sure what though...

As for the Hair code, it's still not working.
In response to Xx Ohone xX
Let me take another look at the hair.
turf/HairSelect
icon = 'preview.dmi'
Ichigo/icon_state = "ichigo"
Click()
switch(alert("You want this hair?","Hair Select","Yes","No"))
if("Yes")
usr.hair = "ichigo"
usr.overlays += 'Ichigo Hair.dmi' // try this one it puts the icons direcly to the players head.
world << "<font size=1><b><font color=silver>BFHH: <font color=white>[usr.name] has logged in."
usr.loc = locate(300,300,1)
usr.online = 1
usr.cansave = 1
usr.cantalk = 1
usr.OOC = 1
usr.Bonus()



obj/hair
ichigohair
icon = 'Ichigo Hair.dmi'

Since my last adjustment didn't work tell me if this one does.
mob
verb

Chat()
set category = "Commands"
if(!usr.cantalk) return
if(usr.muted) return
if(!usr.firing)
usr.firing = 1
var/ms = input("What would you like to say to the people in your view?","View Chat")as text|null
if(!ms) return
var/msg = copytext(ms,1,200)
for(var/mob/client/M in oview(usr)) M << "<b><font size=1><font color=red>{<font color=#FF7777>View Chat<font color=red>} [usr] says: <font color=silver>[html_encode(msg)]" // try putting a /client/M in there so it's talking about Players.
sleep(8)
usr.firing = 0
else return


Try this one out.
It's going to make it so you can't see the text but people in you're view will be able to.
if you want to fix it add a:
usr << "<b><font size=1><font color=red>{<font color=#FF7777>View Chat<font color=red>} [usr] says: <font color=silver>[html_encode(msg)]"
Xx Ohone xX wrote:
I type in what I want to say (Which means the cantalk/muted if statements are not the problem), but then when I pres OK nothing happens.

mob
verb
Chat()
set category = "Commands"
if((usr.cantalk && !usr.muted && !usr.firing))
usr.firing = 1
var/ms = input("What would you like to say to the people in your view?","View Chat") as text|null
if(ms)
var/msg = copytext(ms,1,200)
ohearers(usr) << "<b><font size=1><font color=#FF7777>View Chat</font><font color=red> [usr] says: </font><font color=silver>[html_encode(msg)]</font></b>"
usr << "You said: [html_encode(msg)]"
sleep(8)
usr.firing = 0


Tested and works.

(Btw. ohearers excludes yourself, like oview, so if you're not outputting to the user as well, s/he won't be able to hear anything)

P.S.: If you have no "map" set up, everyone is located at "null", were ohearers returns an empty list as it seems.

Edit: Fixed a little typo and a minor performance issue with bitflags (thanks to *censor* for hinting me at the bad use of logic not).