Now im trying to make a chat that you click a button, and it dissapears, and when you click again, it appears, tried something like this but it doesn't work, what im doing wrong?
Im a newbie in code, please don't laugh ;-;
obj/chatbutton
name = "turnchat"
icon = 'base.dmi'
Click()
if(usr.openchat == 1)
usr.closechatproc()
if(usr.closechat == 1)
usr.openchatproc()
mob/var/openchat=1
mob/var/closechat=0
mob
proc
closechatproc()
set hidden=0
set category="Options"
winset(src,"chat","is-visible=false")
usr.closechat=1
usr.openchat=0
mob
proc
openchatproc()
set hidden=0
set category="Options"
winset(src,"chat","is-visible=true")
usr.openchat=1
usr.closechat=0
Think about this one variable like a door. When the variable is equal to 1, the door is open, and when it is 0 the door is closed. You could also think of it as a toggle. When you think about it like that being able to toggle windows like this should come to you much easier.
Also, I would advise using src instead of usr in procs until you have a solid understanding of what the differences are.