#define DEBUG
mob/var/clan/clan
var/list/clans=list() // list used to store all clans
clan
var
name
list/members=list()
resources
clan_panel
proc
AddMember() // used to add a member to the clan
RemoveMember() // used to remove a member to the clan
SetStatus() // used to set the rank a member of the clan
RemoveFunds() // used to remove funds to the clan
Leader() // used to automatically grab the leader of the clan.
DisbandClan() // used to obliterate all clan members and delete the clan entirely.
New(mob/L, id)
name=id
src.AddMember(L)
src.SetStatus(L,"Leader")
L<<"You have created the clan: [name]."
clans+=src
Del()
for(var/M in members)
RemoveMember(M)
clans-=src
..()
clan
AddMember(mob/M)
members+=M.key
M.clan=src
RemoveMember(mob/M)
M.verbs-=typesof(/mob/clan/Leader/verb)
M.verbs-=typesof(/mob/clan/Recruiter/verb)
M.verbs-=typesof(/mob/clan/Member/verb)
members-=M.key
M.clan=null
SetStatus(mob/M,status)
members[M]=status
switch(status)
if("Leader")
M.verbs+=typesof(/mob/clan/Leader/verb)
M.verbs+=typesof(/mob/clan/Recruiter/verb)
M.verbs+=typesof(/mob/clan/Member/verb)
if("Recruiter")
M.verbs+=typesof(/mob/clan/Recruiter/verb)
M.verbs+=typesof(/mob/clan/Member/verb)
if("Member")
M.verbs+=typesof(/mob/clan/Member/verb)
DisbandClan()
del(src)
Leader()
return members[1]
mob
clan
Leader
verb
Remove_Member(var/mob/M in src.clan.members)
set category="Clan"
src.clan.RemoveMember(M)
Disband_Clan()
set category="Clan"
src.clan.DisbandClan()
Change_Rank(var/mob/M in src.clan.members)
set category="Clan"
var/newrank=input("Make [M] what","promote/demote")in list("Member","Recruiter")
src.clan.SetStatus(M,newrank)
Recruiter
verb
Invite(var/mob/m in world)
set category="Clan"
src.clan.AddMember(m)
Member
verb
Clan_Member_Tab()
verb
CreateClan(c as text)
if(clan)return
new/clan(usr,c)
ViewClans()
for(var/clan/c in clans)
usr<<"[c.name]<br>Members: [c.members.len]<br>"
// save world proc
proc
save_world()
if(fexists("world.sav"))
fdel("world.sav")
var/savefile/f = new("world.sav")
f << global.year
f << world.time - global.yearstart
Problem description:
When I load my character I get error messages. Not sure why, but these are the messages;
runtime error: Cannot read null.key
proc name: AddMember (/clan/AddMember)
source file: Clan.dm,156
usr: null
src: /clan (/clan)
call stack:
/clan (/clan): AddMember(null)
/clan (/clan): New(null, null)
Gluscap (/mob): Load()
Gluscap (/mob): Login()
Gluscap (/mob): Login()
Gluscap (/mob): Login()
runtime error: Cannot read null.verbs
proc name: SetStatus (/clan/SetStatus)
source file: Clan.dm,170
usr: null
src: /clan (/clan)
call stack:
/clan (/clan): SetStatus(null, "Leader")
/clan (/clan): New(null, null)
Gluscap (/mob): Load()
Gluscap (/mob): Login()
Gluscap (/mob): Login()
Gluscap (/mob): Login()
If I save the clan to key, it stops some of the error messages but not all. Though saving it to key creates error messages when I try to create a clan ingame.
Here is the resource I pulled the clan datum from http://www.byond.com/developer/Aries/clan
Here is a better resource, a guild system I wrote for someone else recently:
http://www.byond.com/forum/?post=1476153#comment8538817