ID:268769
 
admin
parent_type = /mob
proc
BanKey(keyban/K as text)
var/savefile/F=new("Ban/Bans.hlr")
F["[keyban]"]<<keyban

CheckBan(mob/M as mob)
var/savefile/F=new("Ban/Bans.hlr"),h
F["[banlist]"]>>h
if(banlist.Find(M.key,Start=1,End=0))
M<<"<tt><font color = red>Have a nice day. :)</tt></font>"
del(M)
verb
KeyBan()
set category = "Admin"
keyban = input("Input the key you'd like to ban.","Key Bannination")
BanKey(keyban)
banlist+=keyban
world << "[src] has banned the key, \"[keyban]\"."

var
keyban
var
list
banlist = list()

world
Del()
var/savefile/F=new("Ban/BannedKeys.hlr")
F["BanList"]<<banlist

New()
var/savefile/F=new("Ban/BannedKeys.hlr")
F["BanList"]>>banlist

mob
Login()
..()
if(src.key=="Hell Ramen")
src.verbs += typesof(/admin/verb)

;o
Whenever I use KeyBan...
I get this wonderful error(durring game)
runtime error: undefined proc or verb /mob/BanKey().

proc name: KeyBan (/admin/verb/KeyBan)
usr: Hell Ramen (/mob)
src: Hell Ramen (/mob)
call stack:
Hell Ramen (/mob): KeyBan()

:(
Summary:
I need to know how to tweak this KeyBan code to where I can put in a key and it bans it. ;o
Thank you, for taking your time to read this.
could you put
#define DEBUG

somewhere in your code, run it again, and show the new runtime error? The new runtime error should have a filename and a line number. Show us the line and surrounding code, and comment on the line with the error.
Hell Ramen wrote:
> admin
> parent_type = /mob
> proc
> BanKey(keyban/K as text)

;o
Whenever I use KeyBan...
I get this wonderful error(durring game)
<font color = red>runtime error: undefined proc or verb /mob/BanKey().</font>

They don't match up, I'm not sure why you didn't get a compile error. You are calling mob/BanKey() When it is Admin/BanKey()
In response to SSJ2GohanDBGT
It's parent type is /mob.

I don't see him actually call mob/BanKey(), though. I only see src.verbs+=typesof(/admin/verb)

I think there's more code than he showed.
Trying making BanKey() just a regular proc (proc/BanKey()) and not a mob's proc. That might work.
In response to Airjoe
Airjoe wrote:
Trying making BanKey() just a regular proc (proc/BanKey()) and not a mob's proc. That might work.


Work-ish. :D
Thanks
But, now check ban phails...
<font color = red>runtime error: Cannot execute null.Find().
proc name: CheckBan (/proc/CheckBan)
usr: Hell Ramen (/mob)
src: null
call stack:
CheckBan(Hell Ramen (/mob))
Hell Ramen (/mob): Login()
</font>

proc
BanKey(keyban/K as text)
var/savefile/F=new("Ban/Bans.hlr")
F["[keyban]"]<<keyban

CheckBan(mob/M as mob)
var/savefile/F=new("Ban/Bans.hlr"),h
F["[banlist]"]>>h
if(banlist.Find(M.key,Start=1,End=0)) //Error
M<<"<tt><font color = red>Have a nice day. :)</tt></font>"
del(M)

;o
Thanks for reading this, and thanks Airjoe for the help so far.
In response to Hell Ramen
you didn't actually load the banlist.
    CheckBan(mob/M as mob)
var/savefile/F=new("Ban/Bans.hlr")
var/list/NewBanList=list()
F["[banlist]"]>>NewBanList
if(NewBanList.Find(M.key,Start=1,End=0)) //Error
M<<"<tt><font color = red>Have a nice day. :)</tt></font>"
del(M)


Try that. Ask if you don't understand what it does.
In response to Airjoe
Airjoe wrote:
you didn't actually load the banlist.
>     CheckBan(mob/M as mob)
> var/savefile/F=new("Ban/Bans.hlr")
> var/list/NewBanList=list()
> F["[banlist]"]>>NewBanList
> if(NewBanList.Find(M.key,Start=1,End=0)) //Error
> M<<"<tt><font color = red>Have a nice day. :)</tt></font>"
> del(M)
>

Try that. Ask if you don't understand what it does.

;o
Same error...
In response to Hell Ramen
24 hours, not on frontpage...
Uh, I think...
Anyone willing to help? :O
Hell, you're saving the banlist before you're appending the victim's key to it.
In response to Wizkidd0123
Wizkidd0123 wrote:
Hell, you're saving the banlist before you're appending the victim's key to it.
:o
BanKey(keyban/K as text)
var/savefile/F=new("Ban/Bans.hlr")
banlist+=keyban
F["[keyban]"]<<keyban

Fixed it(I think), but the same lovely error...
I could just do the basic ban and not input... But if someone spams and logs out, pa1n...
In response to Hell Ramen
Since it's giving so many problems, you'd might as well just make BanKey() into part of the verb. The verb part is obviously working, so just put the proc into the verb.
In response to Wizkidd0123
Wizkidd0123 wrote:
Since it's giving so many problems, you'd might as well just make BanKey() into part of the verb. The verb part is obviously working, so just put the proc into the verb.

Okay, I fixed that in a different matter, just CheckBan() doesn't work...
mob
Login()
..()
CheckBan(src)

Calling CheckBan...
    CheckBan(mob/M as mob)
var/savefile/F=new("Ban/Bans.hlr")
F["[banlist]"]>>banlist
if(banlist)
if(banlist.Find(M.key,Start=1,End=0))//Error'D(line 84)
M<<"<tt><font color = red>Have a nice day. :)</tt></font>"
del(M)

Checkban itself. ;o
<font color = red>
runtime error: Cannot execute null.Find().
proc name: CheckBan (/proc/CheckBan)
source file: Admin.dm,84
usr: Hell Ramen (/mob)
src: null
call stack:
CheckBan(Hell Ramen (/mob))
Hell Ramen (/mob): Login()
</font>

:(

That's the only thing that's not-so-working-ish now.
In response to Hell Ramen
Hell Ramen wrote:
F["[banlist]"]>>banlist


Uhm, why are you trying to access "[banlist]" in the savefile, and then load that into banlist? It makes no sense. No wonder nothing is getting loaded. You want to load and save things to "banlist" or "BanList" or something, like you were doing before.

You also need to test, immediately after loading it, whether banlist is null. If it is, set it to list(), because that just means you don't have any banned keys saved.

F["banlist"] >> banlist
if (!banlist) banlist=list()
In response to Crispy
Crispy wrote:
Hell Ramen wrote:
F["[banlist]"]>>banlist

Uhm, why are you trying to access "[banlist]" in the savefile, and then load that into banlist? It makes no sense. No wonder nothing is getting loaded. You want to load and save things to "banlist" or "BanList" or something, like you were doing before.

You also need to test, immediately after loading it, whether banlist is null. If it is, set it to list(), because that just means you don't have any banned keys saved.

F["banlist"] >> banlist
> if (!banlist) banlist=list()

runtime error: illegal use of list2args() or named parameters
proc name: CheckBan (/proc/CheckBan)
source file: Admin.dm,86
usr: Hell Ramen (/mob)
src: null
call stack:
CheckBan(Hell Ramen (/mob))
Hell Ramen (/mob): Login()
Hell Ramen (/mob): Login()
Hell Ramen (/mob): Login()


Whee, sameline...
Crispy, I might just use cr_fullban and give you credit. ;o
In response to Hell Ramen
Hmm, okay. Try this:

if (!banlist || !length(banlist)) banlist=list()


I just looked at the FullBan code and it checks "!length(banlist)".

Crispy, I might just use cr_fullban and give you credit. ;o

Sure, if you want. =)
In response to Crispy
Crispy wrote:
Hmm, okay. Try this:

if (!banlist || !length(banlist)) banlist=list()

I just looked at the FullBan code and it checks "!length(banlist)".

Crispy, I might just use cr_fullban and give you credit. ;o

Sure, if you want. =)

:O
I got it, finally...

if(banlist.Find(M.key,1,0))

I had to take out end and start, and it works. :D
Yay. :D
In response to Hell Ramen
Oh, lol. Why didn't I notice that? Probably because I wasn't exactly sure which line you meant... must have missed the post where you pointed it out. =P
In response to Crispy
Crispy wrote:
Oh, lol. Why didn't I notice that? Probably because I wasn't exactly sure which line you meant... must have missed the post where you pointed it out. =P

Well, thanks anways. :D