ID:162470
 
So I have been informed that my get() verb is fine, it is the fact that my spellbook is just a list is why I can not actually put objects into it. So I find myself back at square one.

Here is what I need:

A stat panel, which only shows up to specific classes called "Spellbook", which contains scrolls that spellcasters get from killing monsters (or each other.)

From this stat panel, they can use the verbs associated with that scroll. Here is an example:

obj
spell
icon = 'shopicons.dmi'
icon_state = "spells"
layer = 1
spell = TRUE
stackable = TRUE
Firestorm
verb
prepare()
if(usr.guneqed != null)
usr <<"You already have something in your hands."
else if(usr.meleeeqed != null)
usr <<"You already have something in your hands."
else if(usr.spellprepared!=null)
usr <<"You have another spell prepared!"
else
usr.spellprepared = name
usr.spellbon = 100
unprepare()
if (usr.spellprepared != name)
usr <<"You do not have that spell prepared."
else
usr.spellprepared = null
usr.spellbon = 0
cast()
usr.DistanceTo(usr)
if (usr.target == null)
usr << "Please select a target."
else if (usr.target.HP <= 0) //if M's HP are at or below 0...
usr << "[usr.target] is already dead!"
else if (usr.dist > usr.intelligence)
usr << "The target is too far away!"
else if (usr.HP <= 0)
usr << "You are dead!"
else if (usr.meleeeqed != null)
usr << "You can not use melee attacks with a gun!"
else if (usr.guneqed != null)
usr << "You have a gun equiped!"
else if (usr.spellprepared != name)
usr << "You have the wrong spell prepared."
else if (usr.attackfree == 1)
usr << "You must wait for your current attack to finish"
else
usr.dir = get_dir(usr,usr.target)
flick("casting",usr) //show another icon
usr.attackfree = 1
usr.Delay(5)
sleep(2)
usr.AttackFree(usr)
for(var/mob/M in range(1,usr.target))
missile(/obj/firestorm, usr, M)
spawn()M.HitCheckMagic(usr)
M.overlays += /obj/overlay/explosion
sleep(3)
M.overlays -= /obj/overlay/explosion


How do I do this?
It may be easier if you simply place the spell objects inside of src.contents, and then inside the stat function loop through src.contents and see if spell == TRUE, and if so, display it. When it's displayed to them they'll be able to access verbs attached to those objects. o.o

Edit: Figured I'd be a little more helpful.

mob
Stat()
if(src.class == "Blabla")
statpanel("Spellbook")
for(var/obj/spell/S in src.contents)
if(S && S.spell)
stat(S)
In response to Mendon
Ok, then I suppose I would also need to program scrolls to not offer up verbs to people of certain classes?
In response to Zuglilth
Just don't give those spells to those classes. o.o