ID:174571
 
mob/verb/insurance()
var/ins = input("Which insurance?") in typesof(/turf/medic) - /turf/medic
usr.insurance = ins



That works great and all, but it says /turf/medic/free, etc int he list. How can I have the turfs name in the list instead of the path/type? So it says Free, Basic, Advanced, etc.

Thanks,

-ST
you can always make the list using the for proc like

var/Xlist = list("Cancel")
for(var/turf/medic/M in world)//or usr.contents oview(1) ect
Xlist += M
var/ins = input("Which insurance?") in Xlist - /turf/medic
usr.insurance = ins


i have no clue if that will work just thought through it together but you should be able to do it using something like this
The only way I can think of right off hand (someone else might have a more efficient way to do it) is to create an associative list that links a name to a type. Something like this:

<code>var/list/medic_types = list( "Free Medical" = /turf/medic/free, "Basic Medical" = /turf/medic/basic, "Advanced Medical" = /turf/medic/advanced, )</code>

Then have the them choose a name from the list of medic types, and use the association to refer to the type linked with the name.

<code>mob/verb/insurance() var/ins = input("Which insurance?") in medic_types usr.insurance = medic_types[ins]</code>
Sariat wrote:
> mob/verb/insurance()
> var/ins = input("Which insurance?") in typesof(/turf/medic) - /turf/medic
> usr.insurance = ins
>

That works great and all, but it says /turf/medic/free, etc int he list. How can I have the turfs name in the list instead of the path/type? So it says Free, Basic, Advanced, etc.

Thanks,

-ST

To get the name, you'd actually have to create an instance of each type.

mob/verb/insurance()
var/insurance_types = list()
for(var/i in typesof(/turf/medic)-/turf/medic)
insurance_types += i
var/turf/medic/ins = input("Which insurance?") in insurance_types
usr.insurance = ins.type


Something like that should work, but there's really no need to create the list every time the verb is used. You should probably generate the list once and reuse it. Since it's based on hard coded types, it shouldn't be dynamic. You can probably just use the same list over and over again.
In response to Foomer
Thanks Foomer, one more thing, if ya don't mind. How can I change it in the stat panel? In the stat panel it says /turf/medic/free etc. How could I use the list in the statpanel so that the name comes up?