ID:178718
 
Residental
icon_state = "Residental"
New(client/C)
screen_loc = "2,7"
C.screen+=src
Click(Type in MyListofBuildTypes)
build_type = Type


mob
var
build_type
list/MyListofBuildTypes = list(/turf/Residental)
// change MyListofBuildTypes whenever something happens that would change the build choices this mob has


I get errors. what is wrong?
Tazor07 wrote:
Residental
icon_state = "Residental"
New(client/C)
screen_loc = "2,7"
C.screen+=src
Click(Type in MyListofBuildTypes)
build_type = Type


mob
var
build_type
list/MyListofBuildTypes = list(/turf/Residental)
// change MyListofBuildTypes whenever something happens that would change the build choices this mob has


I get errors. what is wrong?

what errors?
In response to Nebathemonk
2 undefined var errors
In response to Tazor07
Under Click you use two mob variables, but it is inside a Residential proc. You need to use usr. instead of the implied src.
In response to English
turf
Residental
icon = 'Turf.dmi'
icon_state = "Houses"
mob
var
build_type
list/MyListofBuildTypes = list(/turf/Residental)

Residental
icon_state = "Residental"
New(client/C)
screen_loc = "2,7"
C.screen+=src
Click(Type in usr.MyListofBuildTypes)
usr.build_type = Type

turf
Sand
icon = 'Turf.dmi'
icon_state = "Sand"
Click()
if(usr.build_type)
new usr.build_type(usr)

The resental part is a obj used for my hub menu. I tried your way and it get rid of the errors. But it still wont work. The turf/sand is for where you can click and build the redental. Any ideas?
In response to Tazor07
FAQ States under "Bad Vars", or undefined vars:

http://www.deadron.com/byond/ByondBwicki.dmb?BadVar
In response to Tazor07

Click(Type in usr.MyListofBuildTypes)
usr.build_type = Type

Now that I look at this more closely I'm not sure this is what you want. Do you want to click on the Residential object so you'll then build that type when you click on the sand? If that is the case then just use it's type:
Click()
usr.build_type = type //defaults to src.type

If you need to use the list I suggest like this:
Click()
usr.build_type = input("What Type?","Type") in usr.MyListofBuildTypes

turf
Sand
icon = 'Turf.dmi'
icon_state = "Sand"
Click()
if(usr.build_type)
new usr.build_type(<font color=red>src</font>)

You'll want to make that change or else it will try to create the object IN the usr instead of where you clicked.
In response to English
I tried out your way but it now builds the thing i click on to change the build type to the actually menu that i click. What i am trying to do is make a different obj from the menu. I want the menu to create something else not another menu.
In response to Tazor07
If you want only one build type per menu then just have a newtype var for it:

Residential
var/newtype = /obj/house //or whatever type you want
Click()
usr.buildtype = newtype

Or if you want a list of possabilities just make it a list:

Residential
var/list/newtypes = list(/obj/house,/turf/park)
Click()
usr.buildtype = input("Which type?","Type") in newtypes
In response to English
how would you make the newtype var work in the sand click proc so if it is residental it minuses 100 dollars and puts pop up by 20? I tried it and it says newtype is a undefined var. take a look

Sand
icon = 'Turf.dmi'
icon_state = "Sand"
Click()
if(usr.build_type)
new usr.build_type(src)
if(usr.build_type == newtype)
usr.Cash -= 100
In response to Tazor07
That's because newtype is defined for Residential objs not Sand turfs.

If you only have one type of residential then you can just compare the types like this:

if(usr.buildtype == /obj/house)
usr.cash -= 100

You may want to sit down and think about how to easily structure this to reduce redundancies.

One way would be to create global lists for this sort of thing:

var/list/ResTypes = list(/turf/house,/turf/park)
var/list/ComTypes = list(/turf/store,/turf/shop)

obj/Residential
Click()
usr.buildtype = input("which type","type") in ResTypes
turf/Sand
Click()
new usr.buildtype(src)
if(ResTypes.Find(buildtype))
usr.cash -= 100
usr.pop += 20

This probably won't cut and paste but it should give you some ideas.
In response to English
I dont cut and paste anyway, im at school so i havent had the chance to try it on my game thanks anyway