ID:164898
 
ok so i made a new game and i decided to put chat options in first. So I wrote this...

//This is a game created by FretfulGun191 on March 30th, 2007.

var
list
Admins = list ("Fretfulgun191")
if(src.key in Admins)
mob
verb
Announce(msg as text)
world << "[usr] Announces:[msg]"
mob
verb
say(msg as text)
world << "[usr] Says : [msg]"


But I get errors on the admins part. Like src.key is undefined and list is an undefined proc and Announce is out of place. I tried fixing that but i really couldnt do it. Anyone know what teh problem is?
There are a couple of problems with that, you are trying to give a variable a verb? Your not even giving the verb properly. You should be checking if you're an administrator under 'say'. Also, you should check if they are an administrator with the Login function or New. Like so:
mob
Login()
if(key in Admin)
new/admin/verb/announce(src) //Add the verb to the user since he's in the admin list.
//I didn't see any problems with your administrator list, so you don't need to change\
anything in that.
In response to Speedro
ok thank you very much :)
In response to FretFulGun
No problem, anytime.

In response to Speedro
And here's a quick way to add all verbs in that datum:
mob/Login()
..()
if(ckey in Admin)
verbs+=typesof(/Admin/verb) //Adds all verbs under Admin/verb


- GhostAnime
In response to GhostAnime
Well you beat me to explain this, lol. I just replied nearly the same thing in his other post on Developer How-To.

-KirbyAllStar
In response to KirbyAllStar
agghhh this is still not working for me.

I have this now...

mob
Login()
if(usr.key in admins)
new
admins
verb
announce(msg as text)
world << "[usr] Announces:[msg]"
var
list
admins = list("Fretfulgun191")


Can anyone clear this up for me? And thanks for all the help

and what is a src? just wondering...
In response to FretfulGun191
Here ya go, If you haven't already read it.
(Don't worry its not the dm guide lol)
-KirbyAllStar
In response to KirbyAllStar
i tried that as well. I got TWO more errors with that one than the one i made :( i dont get it why does dream maker hate me :P
In response to FretfulGun191
It doesn't hate you, what errors did you get with the code I showed you?

-KirbyAllStar
In response to KirbyAllStar
loading game.dme
game.dme:18: unterminated text expression (expecting ])
game.dme:18:error: missing expression
game.dme:18:error: end of file: expected }
game.dm:4:error: location of top-most unmatched {

game.dmb - 7 errors, 0 warnings (double-click on an error to jump to it)


and once more.. what is src?
In response to FretfulGun191
Very sorry about that, but it was an easy fix...

var/list/admins=list("FretFulGun")

mob/Admin/verb/announce(msg as text)
world << "[html_encode(usr.name)]<font color = red>ANNOUNCES [html_encode(msg)]!"

mob/Login()
if(src.key in Admins)
src.verbs+=typesof(/mob/Admin/verb/)
..()


src is what calls the proc, I believe, usr is passed between procs and therefore isn't safe, its always better to use src in procs and usr in verbs although src works in both(I think)

so replace all your usr's in Login() to src

-KirbyAllStar
In response to KirbyAllStar
Thank you sooo much lol it now works :)
In response to FretfulGun191
No problem.

-KirbyAllStar