ID:789019
 
(See the best response by Lugia319.)
Code:
mob/verb
AddGoon(mob/M)
if(usr.Batman)
if(M.Goon)
M.switch(alert("do you wish to be a goon for [usr]","","Yes","No"))
if("Yes")
M<<"You are now a batman goon"
M.BatmanGoon = 1
M.BatmanGoonLeader = "[usr]"
usr.verbs += typesof(/mob/BatmanLeader/verb)
if("No")
usr<<"[M] denied your request"

mob/BatmanLeader/verb
Kick(mob/M)
if(BatmanGoonLeader == "[src]"
M.BatmanGoon = 0
M.BatmanGoonLeader = ""


Problem description:
Verbs.dm:48:error: proc definition not allowed inside another proc
Verbs.dm:56:error: unbalanced }

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


M.switch() is improper syntax. You want to look switch() up in F1 and see which argument of switch you want to place M in.

You also left out the closing parentheses in your if() statement in the kick verb.
mob/verb
AddGoon(mob/M)
if(usr.Batman)
if(M.Clan == "Goon")
switch(alert("do you wish to be a goon for [usr]","","Yes","No"))
if("Yes")
M<<"You are now a batman goon"
M.BatmanGoon = 1
M.BatmanGoonLeader = "[usr]"
usr.verbs += typesof(/mob/BatmanLeader/verb)
if("No")
usr<<"[M] denied your request"

mob/BatmanLeader/verb
Kick(mob/M)
if(BatmanGoonLeader == "[src]")
M.BatmanGoon = 0
M.BatmanGoonLeader = ""
In response to Dr.Penguin
What's the issue with that one? you haven't told us anything.
I havent tested that one
The issue is going to be that the person asking someone to be their goon is going to be asked if they want to become a goon for themself. He did not utilize the first argument of alert(), so the person doing the proc gets the alert instead of the target.
What do i do with it
alert()'s first argument should be a mob reference. It is who you're going to be sending the message to. You had the right idea with M.switch(alert()) but you put things in the wrong places.
loading Batpenguin.dme
Verbs.dm:50:error: proc definition not allowed inside another proc
Verbs.dm:59:error: unbalanced }

Batpenguin.dmb - 2 errors, 0 warnings (double-click on an error to jump to it)
You're using a proc to define another proc, that's the cause of the first error. The second error means you have an open parentheses somewhere.
mob/verb
AddGoon(mob/M)
if(usr.Batman)
if(M.Clan == "Goon")
M.switch(alert("do you wish to be a goon for [usr]","","Yes","No"))
if("Yes")
M<<"You are now a batman goon"
M.BatmanGoon = 1
M.BatmanGoonLeader = "[usr]"
M.Clan = "BatmanGoon"
usr.verbs += typesof(/mob/BatmanLeader/verb)
if("No")
usr<<"[M] denied your request"

mob/BatmanLeader/verb
Kick(mob/M)
if(BatmanGoonLeader == "[src]")
M.BatmanGoon = 0
M.BatmanGoonLeader = ""



Error:
loading Batpenguin.dme
Verbs.dm:50:error: proc definition not allowed inside another proc
Verbs.dm:59:error: unbalanced }

Batpenguin.dmb - 2 errors, 0 warnings (double-click on an error to jump to it)
mob/verb
AddGoon(mob/M)
if(usr.Batman)
if(M.Clan == "Goon")
M.switch(alert("do you wish to be a goon for [usr]","","Yes","No"))
if("Yes")
M<<"You are now a batman goon"
M.BatmanGoon = 1
M.BatmanGoonLeader = "[usr]"
M.Clan = "BatmanGoon"
usr.verbs += typesof(/mob/BatmanLeader/verb)
if("No")
usr<<"[M] denied your request"

mob/BatmanLeader/verb
Kick(mob/M)
if(BatmanGoonLeader == "[src]")
M.BatmanGoon = 0
M.BatmanGoonLeader = ""


You can't put M.switch(). That's now how it works. You want the M inside the alert, as the first argument.
Where do i put it like that?

        switch(M.alert("do you wish to be a goon for [usr]","","Yes","No"))

because it doesnt work like that
Think about what each proc is doing. If you need help figuring out where everything goes, look up switch() and alert() in F1
i dont understand it
Did you read the two reference articles that Lugia suggested to you? As your comment came only three minutes later, I'm a little septicaemic that you did your own reading and research and tried to understand it.

Reading something new won't immediately make sense to you; you have to play around with it, see how it works, and try writing independent examples.
Yes both it doesn't show anything about the mob
You have one function call here, and a control structure. alert() is the function, and switch() is the control structure. The function is presumably going to return some data, and then the control structure is going to do something with that data.

If you don't know how to use either of these, look both of them up in the reference, as they are both well documented.
Yeah it does. Or rather alert() does.

Format:
alert(Usr=usr,Message,Title,Button1="Ok",Button2,Button3)
Returns:
Selected button
This sleeps the current proc until the user clicks one of the named buttons. As with input(), the first argument may be entirely left out.

From the reference;

The "switch" instruction is a compact notation for a lengthy "else-if" chain. The expression E is compared to the values A1, A2, B1, B2, etc. When a match is found, the following statement (or code block) is executed.

Syntax;
switch(e)
if(1)
if(2)

So, what we do is give switch something to look at; in this case, you want it to be the reply to your alert statement.
Then, we compare the reply to the possible options; that bit is fine.

Then, we handle the consequences for M.

Think about who or what 'owns' the switch statement; it's not M.

lert()'s first argument should be a mob reference. It is who you're going to be sending the message to. You had the right idea with M.switch(alert()) but you put things in the wrong places.

This is also very true.
Format:
alert(Usr=usr,Message,Title,Button1="Ok",Button2,Button3)
Returns:
Selected button


You're missing an argument here which you need; alert() takes, in order, the following:
The user of the procedure ( the person pressing the buttons )
The message.
The title.
The buttons.
Page: 1 2