ID:141803
 
Yeah, two problems.

1st Code:
obj
var
sellamount = 0
Pokeball
obj
Pokeball
name = "Pokeball"
icon = 'Npcs.dmi'
icon_state = "Pokeball"
sellamount=100
Pokeball=1
verb
Pick_Up_Pokeball()
set category="Item Commands"
set src in oview(1)
src.Move(usr)
usr << "[usr.name] gets [src.name]."
Drop_Pokeball()
set category="Item Commands"
src.Move(usr.loc)
usr << "[usr.name] drops [src.name]."
Catch_Pokemon(var/mob/M as mob in oview()) //The catch verb.
set category="Poke-Commands"
if(src.Pokeball==1)
if(istype(M,/mob/Pokemon))
usr << "You successfully caught [M]!"
M.loc = usr.contents2
del (src)
else
usr << "You can't catch [M]!"
mob/var
contents2[] = list()
statpanel("Inventory")
stat("List of Items:")
stat("",contents)
stat("Pokemon:")
stat("",contents2)


Problem description: Pokemon get caught, but disappear...

2nd Code:
        Save()
var/savefile/Q = new("World/Players/[usr.ckey].sav")
Q["X"] << src.x
Q["Y"] << src.y
Q["Z"] << src.z
Q["Name"] << src.name
Q["Icon"] << src.icon
Q["IconState"] << src.icon_state
Q["dir"] << src.dir
Q["admin"] << src.admin
Q["rank"] << src.rank
Q["gender1"] << src.gender1
Q["trainer"] << src.trainer
Write(Q)
usr << "<b><font color=blue>Game saved!"
mob
proc
Load()
if(fexists("World/Players/[usr.ckey].sav"))
var/savefile/Q = new("World/Players/[usr.ckey].sav")
Read(Q)
Q["X"] >> src.x
Q["Y"] >> src.y
Q["Z"] >> src.z
Q["Name"] >> src.name
Q["Icon"] >> src.icon
Q["IconState"] >> src.icon_state
Q["dir"] >> src.dir
Q["admin"] >> src.admin
Q["rank"] >> src.rank
Q["gender1"] >> src.gender1
Q["trainer"] >> src.trainer
usr.Move(locate(src.x,src.y,src.z))
world << "<b><font color=green>Login:</b> <i>[src] has Logged In.</font>"
else
usr<<"<font color=red><b>Error - No save file. Try clicking New."


Code Problem: Doesn't save the admin verbs. So when I click load, it doesn't load the verbs, and I have to click new everytime after coding myself in.
        Save()
var/savefile/Q = new("World/Players/[usr.ckey].sav")
Q["X"] << src.x
Q["Y"] << src.y
Q["Z"] << src.z
Q["mob"] << src
Write(Q)
usr << "<b><font color=blue>Game saved!"
mob
proc
Load()
if(fexists("World/Players/[usr.ckey].sav"))
var/savefile/Q = new("World/Players/[usr.ckey].sav")
Read(Q)
Q["X"] >> src.x
Q["Y"] >> src.y
Q["Z"] >> src.z
Q["mob"] >> src
usr.Move(locate(src.x,src.y,src.z))
world << "<b><font color=green>Login:</b> <i>[src] has Logged In.</font>"
else
usr<<"<font color=red><b>Error - No save file. Try clicking New."



This one should work for you.
If not I don't know.
In response to Gizhy Games
Bad, bad, bad. Never use usr in a proc.
In response to Gizhy Games
Nope. Didn't work Gizhy, thanks for trying though.

Now it just has
Mikeee has logged in!
Mikeee has logged out!
Mikeee has logged in!

If I click load.

Popisfizzy, if you think you know the problem, why not try and actually help by POSTING A CODE next time.
In response to Mikeee
Mikeee wrote:
Popisfizzy, if you think you know the problem, why not try and actually help by POSTING A CODE next time.

Okay, three problems:
  • I was pointing out something bad with his code, as usr is very often unsafe in procs, and he was doing it, which was an obvious problem.
  • There is no such thing as "a code" in most cases in programming. "Code" is both singular and plural, so, if you want to be obnoxious, at least be correct and obnoxious and write, "POSTING CODE".
  • Don't make demands, as that's no way to get help.
Heres the fix for the first code
obj
var
sellamount = 0
Pokeball
obj
Pokeball
name = "Pokeball"
icon = 'Npcs.dmi'
icon_state = "Pokeball"
sellamount=100
Pokeball=1
verb
Pick_Up_Pokeball()
set category="Item Commands"
set src in oview(1)
src.Move(usr)
usr << "[usr.name] gets [src.name]."
Drop_Pokeball()
set category="Item Commands"
src.Move(usr.loc)
usr << "[usr.name] drops [src.name]."
Catch_Pokemon(var/mob/M as mob in oview()) //The catch verb.
set category="Poke-Commands"
if(src.Pokeball>=1)
if(istype(M,/mob/Pokemon))
usr << "You successfully caught [M]!"
usr.contents2+=M
M.loc=usr.contents2
src.Pokeball-=1
else
usr << "You can't catch [M]!"
if(src.Pokeball<1)
del(src)
mob
var
contents2[] = list()
mob/Stat()
statpanel("Inventory")
stat("List of Items:")
stat("",contents)
stat("Pokemon:")
stat("",contents2)

The problem you speak of in the second code isn't in the second code its in the login proc. To fix it you need to load the save file then check the admin vars and then add the verbs
In response to Popisfizzy
Okay, three problems:
  • I was pointing out something bad with his code, as usr is very often unsafe in procs, and he was doing it, which was an obvious problem.
  • There is no such thing as "a code" in most cases in programming. "Code" is both singular and plural, so, if you want to be obnoxious, at least be correct and obnoxious and write, "POSTING CODE".
  • Don't make demands, as that's no way to get help.

  • I didn't know about your Grammer demands. And I know. So why not actually say what you mean. And I didn't demand, I suggested.
In response to Mikeee
I didn't know about your Grammer demands.

It's more like common sense really. Say "a code" out loud, and watch how stupid you sound.

And I know. So why not actually say what you mean.

I believe that was what he meant.

And I didn't demand, I suggested.

The combination of bold text and caps usually means you're yelling, which is demanding when used in a declarative sentence.
In response to Jeff8500
Thanks Chowder ^_^

And Jeff.

Piss off. I'm looking for help with my coding, not an English lesson.
In response to Mikeee
D/w any more. Solved myself. CYAS