ID:273788
 
I'm trying make a grid with a list of spells to cast, and to get it so that spells that can be cast have their names in one color and spells that can't be cast have their name in a different color. I feel like I almost have it, but I seem to be doing something slightly wrong.
var/const/canCastStyle = {"
body {
color:green;
}
"}

var/const/cantCastStyle = {"
body {
color:red;
}
"}

Player
proc
updateSpellPanel()
var/count = 0
for(var/Spell/spell in contents)
if(!istype(spell)) continue
var/style
if(spell.canCast(src))
style = canCastStyle
else
style = cantCastStyle
winset(src,"spellGrid","current-cell=[++count]")
winset(src,"spellGrid","style=[style]")
src << output(spell, "spellGrid")


winset(src,"spellGrid","cells=[count]")

EDIT: Just realized that I probably should have posted this under "Code Problems". Sorry.