ID:169216
 
obj/guild/make
verb
MakeGuild()
set category="Others"
var/savefile/F = new("Guilds.sav")
global.guilds = F["Guilds.sav"]
var/gname = input ("What do you wish to name this guild?") as text|null
if(global.guilds.Find("[gname]"))
alert("That guild name has already been created..")
else
usr.guild = "[gname]"
usr.worldsay = usr.guild
usr.Inguild = 1
global.guilds += "[gname]"
F["Guilds.sav"] << global.guilds
usr.contents += new/obj/guild/leader
usr.verbs += typesof(/mob/Guild/verb)
del(src)

here is the error on the Dreamseeker

runtime error: Cannot execute null.Find().
proc name: MakeGuild (/obj/guild/make/verb/MakeGuild)
source file: Guild.dm,12
usr: Ky (/mob/characters/Mutant)
src: the make (/obj/guild/make)
call stack:
the make (/obj/guild/make): MakeGuild()


I think the error is trying to find the guild if its excist on the sav file but when it doesn't it returns with this error!

i need help but i want to know whats wrong instead of giving me the code. i want to learn the error thats the main reason for posting this thread!

KyleCias
Dtroys wrote:
> obj/guild/make
> verb
> MakeGuild()
> set category="Others"
> var/savefile/F = new("Guilds.sav")
> global.guilds = F["Guilds.sav"]
> var/gname = input ("What do you wish to name this guild?") as text|null
> if(global.guilds.Find("[gname]"))
> alert("That guild name has already been created..")
> else
> usr.guild = "[gname]"
> usr.worldsay = usr.guild
> usr.Inguild = 1
> global.guilds += "[gname]"
> F["Guilds.sav"] << global.guilds
> usr.contents += new/obj/guild/leader
> usr.verbs += typesof(/mob/Guild/verb)
> del(src)
>
> here is the error on the Dreamseeker
>
> runtime error: Cannot execute null.Find().
> proc name: MakeGuild (/obj/guild/make/verb/MakeGuild)
> source file: Guild.dm,12
> usr: Ky (/mob/characters/Mutant)
> src: the make (/obj/guild/make)
> call stack:
> the make (/obj/guild/make): MakeGuild()
>

I think the error is trying to find the guild if its excist on the sav file but when it doesn't it returns with this error!

i need help but i want to know whats wrong instead of giving me the code. i want to learn the error thats the main reason for posting this thread!

KyleCias

I think try
if(!global.guilds.Find("[gname]"))

before you create the save file
In response to Dracon_o
i guess know one here no about this! i think Garthor or Goku72 must know about it!
Dtroys wrote:
global.guilds = F["Guilds.sav"]


I think the problem might be this line. I don't think that's how to load something from a savefile. Try doing F["Guilds.sav"] >> global.guilds
:/
You're using Find() incorrectly.
In response to Dtroys
Dtroys wrote:
i guess know one here no about this! i think Garthor or Goku72 must know about it!

Even I know he goes under Teh Governator
In response to Ol' Yeller
Ol' Yeller wrote:
:/
You're using Find() incorrectly.

if(global.guilds.Find(gname))

i am quite sure thats right but i might be mistaken the global var list. could you please explain to me in details
In response to Dtroys
Find() is used to return a position in a list, you should be using the in operator. :p
In response to Ol' Yeller
Ol' Yeller wrote:
Find() is used to return a position in a list, you should be using the in operator. :p

So? If the item is found, the position will be greater than 0, so his way works too.
In response to Jon88
Jon88 wrote:
Dtroys wrote:
> global.guilds = F["Guilds.sav"]
>

I think the problem might be this line. I don't think that's how to load something from a savefile. Try doing F["Guilds.sav"] >> global.guilds

I have done that but its not the problem making the errors. which occur on dreamseeker. DM is not finding any errors on it because its not influencing the coding to load. i just making a mistake in global sav and finding the text for it
In response to Jon88
But if the list is empty, then Find() can't go through it, thus generating an error.
In response to Ol' Yeller
Ol' Yeller wrote:
Find() is used to return a position in a list, you should be using the in operator. :p

I know its trying to find a obj from a list and i need to know whats wrong with it. I think the code below influencing it.

var/savefile/F = new("Guilds.sav")
F["Guilds.sav"] >> global.guilds
var/gname = input ("What do you wish to name this guild?") as text|null
if(global.guilds.Find(gname))


please explain your help in details.
In response to Ol' Yeller
Ol' Yeller wrote:
But if the list is empty, then Find() can't go through it, thus generating an error.

var/global/list/guilds = list("PowerRanger")


this is my global list var and it already have some thing in it!
In response to Cheetoz
Yeah, but most DBZers know him from LoTD, and he still uses Goku72 for that.
In response to N1ghtW1ng
N1ghtW1ng wrote:
Yeah, but most DBZers know him from LoTD, and he still uses Goku72 for that.

I know that, every one knows him as goku72 or chuck. Any way back to the topic. How do i solve the problem?
In response to Dtroys
I am pretty sure Jon was right. Try and put >> instead of =. If any errors come up, tell us what they are.
In response to N1ghtW1ng
N1ghtW1ng wrote:
I am pretty sure Jon was right. Try and put >> instead of =. If any errors come up, tell us what they are.

there is no error and the error shows up on the Dream seeker!

runtime error: Cannot execute null.Find().
proc name: MakeGuild (/obj/guild/make/verb/MakeGuild)
source file: Guild.dm,12
usr: Ky (/mob/characters/Mutant)
src: the make (/obj/guild/make)
call stack:
the make (/obj/guild/make): MakeGuild()
In response to Dtroys
That is called a runtime error. Did you do what Jon and I said?
In response to Dtroys
Use the in operator and don't use the Find() operator incorrectly. :/ in will work on empty lists
In response to Ol' Yeller
Ol' Yeller wrote:
Use the in operator and don't use the Find() operator incorrectly. :/ in will work on empty lists

whats that in codes?
Page: 1 2