ID:177644
 
How would I put usr.bldexp +=5 into this code

if(choice == "Brick Wall Lv3")
if(usr.bldlevel >=3) { new /turf/BrickWall(usr.loc) }
else
usr << "You need to be level 3"
Anyone???
if(choice == "Brick Wall Lv3")
if(usr.bidlvl >= 3)
usr.bidexp += 5
sleep(1)
new/turf/BrickWall(usr.loc)
else
return
In response to Siientx
thanx.
In response to Siientx
Siientx wrote:
if(choice == "Brick Wall Lv3")
if(usr.bidlvl >= 3)
usr.bidexp += 5
sleep(1)
new/turf/BrickWall(usr.loc)
else
return

What the heck is the sleep() for?

Lummox JR
Codesterz wrote:
How would I put usr.bldexp +=5 into this code

if(choice == "Brick Wall Lv3")
if(usr.bldlevel >=3) { new /turf/BrickWall(usr.loc) }
else
usr << "You need to be level 3"

It's just as simple as adding the line, as ShadowSiientx pointed out. However, I'm a bit worried at the setup for this--it looks like you're using a gigantic bunch of if() statements when a list--or multiple lists--would serve you better.

For example, suppose you had a couple of lists like this:
var/list/buildtypes=list("Brick Wall"=/turf/Brickwall,
"Floor"=/turf/floor)
var/list/buildlevel=list(/turf/BrickWall=3,
/turf/floor=1)

mob
verb/Build()
var/list/L=buildtypes.Copy()
// cull items you can't build out of the list
// you can use a similar technique to restrict items by cost
for(var/item in L)
if(buildlevel[L[item]]<usr.level) L-=item
var/choice=input("What do you want to build?","Build") as null|anything in L
if(!choice) return
usr.bldexp+=5
choice=L[choice] // get the type path that goes with the name
new choice(usr.loc)

I bet you could cut out a lot of redundant code that way.
There are even better ways to do this; a custom datum, for example, might be the ticket:
buildinfo
var/name // shown to usr
var/buildtype // type path
var/level=0 // minimum level needed to build
var/exp=1 // experience from building

New(nm,bt,lvl=0,xp=1)
name=nm
buildtype=bt
level=lvl
exp=xp

Basically then you create a global list of these datums, and you'd build your choice list like this:
  var/list/L=list()
var/buildinfo/B
for(B buildtypes) // now this is a list of datums
if(B.level>=usr.level) L[B.name]=B
var/choice=input("What do you want to build?","Build") as null|anything in L
if(!choice) return
B=L[choice]
usr.bldexp+=B.exp
new B.buildtype(usr.loc)

Lummox JR
In response to Lummox JR
I have no idea. =P

Siient