RPG Starter

by Falacy
An Open Source Demo/Game with everything you'll need to get started on your very own BYOND Game!
ID:292237
 
I cant get a grid work as it should be for example if i want to create a grid full with hair style and when player clicks on it it should send which hair style is player has chose and then it should change it but the code i wrote it only works with the last icon rest of them get ignored any idea how to fix
Clicking something in a grid should work the same way it does anywhere else
In response to Falacy
here is my proc code i use to create grid
ChangeHair(mob/M,message,title,list/options,wait=5)
winshow(M,"alert_list",1)
var/counter
winset(M,"alert_list.alert_list_message","text='[message]'")
winset(M,"alert_list.alert_list_name","text='[title]'")
winset(M,"alert_list","title='[title]'")
for(var/O in options)
counter++
var/C=new O
src<<output(C,"alert_list.alert_list_grid:1,[counter]")
if(wait)
while(M&&!M.chosenobj)
sleep(wait)
if(!M||!M.client) return
winshow(M,"alert_list",0)
if(M.chosenobj=="Ok") M.chosenobj = M.tempchosenobj
if(M.chosenobj=="Cancel") M.chosenobj = null
return M.chosenobj

and here is my click proc
atom
Click(location,control,params)
if(control=="alert_list.alert_list_grid")
usr.chosenobj = src
return
..()
but i can only click on the last one rest of them dont work
In response to Hassanjalil
Whats in the list of options
In response to Falacy
ChangeHair1()
set name=".HairPick"
var/list/List
/*for (var/X in typesof(/obj/Sprites/Hair)-/obj/Sprites/Hair)
var/obj/Sprites/Hair/O=new X()*/

List+=typesof(/obj/Hair)-new/obj/Hair
var/O=ChangeHair(src,"Choose a hair style","Hair Style",list(/obj/Hair/Adult_Gohan_Normal,/obj/Hair/Future_Gohan_Normal,/obj/Hair/Goku_Normal,/obj/Hair/Raditz_Normal,/obj/Hair/Teen_Gohan_Normal,/obj/Hair/Trunks_Normal,/obj/Hair/Vegeta_Normal),wait=5)
if(O)
var/obj/OBJ=O
usr.Remove_Hair()
sleep(1)
usr.Hair_Style="[OBJ]"
usr.Apply_Hair()
usr<<"You changed [OBJ]"
usr.chosenobj=null

option list is the list which stores all objcet related to hair
In response to Hassanjalil
Using var/C=new O causes the objects have no reference point aside from the grid. Just create the new objects when you send the list list(new/obj/Hair/Adult_Gohan_Normal,...), then output O to the grid, instead of C.
In response to Falacy
tnx for another good answer