ID:141694
 
Code:
        Create_Guild()
set category = "Commands"
if(!usr.in_guild)
if(usr.level >= 100)// Change if needed.
if(usr.money >= 1000)// Change if needed.
usr.Create_G()
else usr << "Need more money."
else usr << "Need a higher level."
else usr << "You are in a guild."

proc
Create_G()
switch(alert(src,"Are you sure you would like to create a guild?","Create Guild","Yes","No"))
if("Yes")
src.guild_name = "None"
src.guild_name = input(src,"What would you like to call your guild?","Guild Name")as text|null
if(length(guild_name) < 5)
alert(src,"More letters than 5 please. Create a proper guild name.")
src.Create_G()
if(length(guild_name) > 100)
alert(src,"You trying to spam OOC or something? Don't have more letters than 100.")
src.Create_G()
var/list/html = list("<",">")
if(html in src.guild_name)
alert(src,"No html!")
src.Create_G()
else
world << "<b><font color=aqua>Guild Info:</font> <font color=white>[src] created the guild, [src.guild_name]"
src.money -= 1000 //Change if needed.
src.in_guild = 1
src.guild_rank = 5
src.guild_title = "Guild Leader"
src.verbs += typesof(/mob/Guild_Leader/verb) //Problem 1
src.verbs += typesof(/mob/guild/verb)
if("No")
src.guild_name = "None"
return






mob/Guild_Leader
verb
Give_A_Verb(mob/M in world)
set category = "Guild"
var/list/GVerbs = list()
for(var/Verb in typesof(/mob/Guild_Leader/verb/)) //Problem 2
GVerbs += Verb
var/theverb = input("Which verb do you wish to give to [M]?","Give Verb")in GVerbs
M.verbs += theverb


Problem description:

Verbs.dm:67:error:/mob/Guild_Leader/verb/: compile failed (possible infinite cross-reference loop)
Guild.dm:75:error:/mob/Guild_Leader/verb: compile failed (possible infinite cross-reference loop)

What I am trying to do is make it so the guild leader can give a verb to one of his members without giving a verb he doesn't want his member to have. There is more verbs, but I only posted the one since others arn't needed in here.


EDIT:
mob/Guild_Leader
verb
Give_A_Verb(mob/M in world)
set category = "Guild"
var/list/GVerbs = list()
GVerbs += typesof(/mob/Guild_Leader/verb/)
var/theverb = input("Which verb do you wish to give to [M]?","Give Verb")in GVerbs
M.verbs += theverb

// I have also tried this way but I still get the loop error.
> mob/Guild_Leader
> verb
> Give_A_Verb(mob/M in world)
> set category = "Guild"
> var/list/GVerbs = list()
> for(var/Verb in typesof("/mob/Guild_Leader/verb/"))
> GVerbs += Verb
> var/theverb = input("Which verb do you wish to give to [M]?","Give Verb")in GVerbs
> M.verbs += theverb
>



You need to enclose the type with double quotes in typesof() so it gets evaluated at runtime and not compile-time, or the compiler will get confused.

For future reference, the forum search</a href> does wonders.
In response to Andre-g1
Andre-g1 wrote:
> > mob/Guild_Leader
> > verb
> > Give_A_Verb(mob/M in world)
> > set category = "Guild"
> > var/list/GVerbs = list()
> > for(var/Verb in typesof("/mob/Guild_Leader/verb/"))
> > GVerbs += Verb
> > var/theverb = input("Which verb do you wish to give to [M]?","Give Verb")in GVerbs
> > M.verbs += theverb
> >

You need to enclose the type with double quotes in typesof() so it gets evaluated at runtime and not compile-time, or the compiler will get confused.

For future reference, the forum search</a href> does wonders.

OK thanks, solved that error. Since I can't test the Give_Guild_Verb verb I made a Take Verb which is similar, but the verb doesn't get taken away.


        Take_A_Verb(mob/M in world)
set category = "Guild"
var/list/GVerbs = list()
for(var/Verb in typesof("/mob/Guild_Leader/verb/"))
GVerbs += Verb
var/theverb = input("Which verb do you wish to give to [M]?","Give Verb")in GVerbs
M.verbs -= theverb
M << "<b>One of your guild verbs were taken."
In response to Howey
var/theverb = input("Which verb do you wish to give to [M]?","Give Verb") as null|anything in typesof("/mob/Guild_Leader/verb/")
M.verbs -= "[theverb]"


Not sure, but I think it has to be embedded.

Also, why make a list when you can just use the list typesof() returns ?
In response to Andre-g1
You need to embed the type path as text into the list, then use text2path() to take it away.