ID:1441029
 
(See the best response by Nadrew.)
what is the simplest code possible for adding a item or w/e to a grid? Like I wanna add a list of passive to a grid but I dunno the easiest way how

You just have to output() to the grid like you would to an output control.

mob/var/obj/myobj = new() // Example

mob/verb/Test()
if(!myobj) myobj = new()
src << output(myobj,"mywindow.mygrid:1,1")


For more details, open Dream Maker, click the Help menu and read the 'Skin Reference', then look up the related procs in the language reference by pressing F1 in Dream Maker. Good luck :)
now how would I do it so i add the icon to objs if i try to do it like

var
obj
fireball
icon='derp.dmi'


it seems it give me crap how do i fix it
Best response
You define the object as normal.

obj
fireball
icon = 'derp.dmi'


Now when you want to display it in a grid it'll have to exist in some kind of list or something.

mob/var/list/skills = list()

mob/verb/LearnFireball()
var/obj/fireball/new_fireball = locate() in usr.skills
if(new_fireball)
usr << "You already know fireball!"
return
new_fireball = new() // create a new fireball object
usr.skills.Add(new_fireball)


Now, when you go to do your grid, just loop over the skills list and display the objects within it.

mob/verb/ShowSkills()
usr << output(null,"mywindow.mygrid") // clear the grid.
for(var/obj/O in usr.skills)
usr << output(O,"mywindow.mygrid:1,[usr.skills.Find(O)]")


is there a way i can skip making like 23423482348 objs for each thing i wanna add to a grid and like lump sum em? Like I wanna make a bunch of passives but use the same icon for it but give it a different name
In response to Mastergamerxxx
Mastergamerxxx wrote:
Like I wanna make a bunch of passives but use the same icon for it but give it a different name

I think you mean like this.

obj
MagicSkills
icon = 'skills.dmi'
icon_state = "magic"

Fireball
//set your variables here

Iceball
//set your variables here