ID:147825
 
mob
verb
Create_Guild()
set name="Create Guild"
set desc = "Sets a user to a guild."
set category = "Guild"
if(usr.zenni >= 75000)
usr.zenni -= 75000
var/guildname = input("Please enter the name of the Guild you wish to create. (Note: Creating a Guild costs 75000 Zenni!)") as text//Displays a usressage asking you what the guild you will put the person in will be as text
if(usr.guild == "null" || usr.guild == "none")
usr.guildleader = "No"
usr.guildrecruiter = "No"
usr.guildtitle = "None"
usr.guild = "None"
usr.zenni += 75000
usr << "You have been removed from the guild that you are currently in which is:[usr.guild]."//Tell the mob that they have been reusroved frousr the guild
usr.removeguildverbsmob(usr)
else
if(!guildname in guildnames)
usr.guildleader = "Yes"
usr.guildrecruiter = "Yes"
usr.guildtitle = "Leader"
usr.guildrecruit=1
usr.guildleaders=1
usr.guilds=1
usr.guild=guildname
guildnames+=guildname
usr.zenni += 75000
usr.addguildverbs()
else
alert("There is already a guild with this name!")
else
alert("You do not have enough Zenni to create a guild!")

var/list/guildnames=list()
world/New()
..()
var/savefile/S=new("Bans.sav")
S["key"] >> crban_keylist
S["IP"] >> crban_iplist
S["unban"] >> crban_unbanned
if (!length(crban_keylist)) crban_keylist=list()
if (!length(crban_iplist)) crban_iplist=list()
if (!length(crban_unbanned)) crban_unbanned=list()
var/savefile/B = new("Guilds.sav")
B >> guildnames

world/Del()
var/savefile/S=new("Bans.sav")
S["key"] << crban_keylist
S["IP"] << crban_iplist
S["unban"] << crban_unbanned
var/savefile/B = new("Guilds.sav")
B << guildnames
..()
Whenever, I create a GUILD, and I put in any name. I get the else part of the code which shouldn't be happening. Also, for when the world shutsdown (world/Del()), I get this error:

runtime error: bad savefile or list
proc name: Del (/world/Del)
usr: null
src:
call stack:
: Del()
: Del()
Vakir (/mob/characters/earthling): Reboot Server()

Can anyone explain to me what is wrong, or even possibly fix it?

Thank you,
Vakir


Vakir wrote:
if(!guildname in guildnames)

I'd suggest that this is your problem. You're trying to use the text variable to locate another text similar to it in a list. Try using the built-in list find procs. Those would be of better help.

These may help (And note, these are directly from the reference.):
Find proc (list)
Format:
list.Find(Elem,Start=1,End=0)
Returns:
The first position of elem in list, or 0 if not found.
Args:
Elem: The element to find.
Start: The list position in which to begin the search.
End: The list position immediately following the end of the search.
Find the first position of Elem in the list. Elements between Start and End are searched. The default end position of 0 stands for the position immediately after the end of the list, so by default the entire list is searched.

findText proc
See also:
findtext proc
Format:
findtext(T1,T2,Start=1,End=0)
Returns:
The position of T2 in T1; 0 if not found.
Args:
T1: The text string to search.
T2: The sub-text to search for.
Start: The text character position in T1 in which to begin the search.
End: The text character position in T1 immediately following the last character to search.
This instruction is sensitive to the case of T1 and T2. The case-insensitive version is findtext().

Example:
if(findText("Hi There","there")==0)
world << "Not found!"
else
world << "Found!"

This outputs "Not found!", since "there" is not a part of the string "Hi There", taking into account case.