I was hoping there's people capable of helping me with this code, which may come off as weird, or completely non-functional..
EDIT: Code comes to number 155, then stops.
/mob
var/savefile/medals = null
var/list/medalslist = list()
/mob/New()
..()
medals = new("data/player_saves/[copytext(src.ckey, 1, 2)]/[src.ckey]/medals.sav")
if(medals)
load_medals(src)
/mob/proc/give_medal(mob/user)
if(!check_rights(R_ADMIN)) return
world << "0"
if(user)
world << "1"
var/medalname = input("What is the medal's name?", "Medal Name", "Medal Of")
var/medaldesc = input("What is the medal for?", "Medal for what?", "Medal given for")
world << "2"
// if(medalname && medaldesc)
var/message = "Medal of [medalname] - [medaldesc] awarded by [usr.ckey]"
world << "155"
if(user && user.medalslist)
world << "156"
user.medalslist.Add(message)
world << "145"
world << "<font color='3cbc2b'><b>Player [user.client] has been awarded the [medalname], for [medaldesc]!</b></font>"
save_medals(user)
/mob/proc/save_medals(var/mob/player)
medals["medallist"] << player.medalslist
// medals["medallist"] << dd_list2text(player.medalslist, "\n")
/mob/proc/load_medals(var/mob/player)
medals["medallist"] >> player.medalslist
// medals["medallist"] >> text2list(player.medalslist, "\n")
/mob/Stat()
statpanel("Medals")
stat("Medals Awarded to you:", dd_list2text(medalslist,"\n"))
/mob/verb/grant_medal(mob/M)
set name = "Grant Medal"
set category = "Admin"
set src in view(usr) //If it can be seen, it can be examined.
world << "11"
give_medal(M)
world << "12"
Problem description:
Problem explained on top.
I hope someone can see the issue and tell me what it was that I did wrong, it'd help me a lot!
Thanks in advance.
I think it's because M is null in this case. Since you are using set src in..., this verb is meant to be called by an admin on someone else.
You can do either this:
Or this: (Which is technically cleaner, but slower)