ID:146417
 
I have asked for help but nobody replyed. my building code is messed up badly, can someone please help me.
problem 1 When i set it to click and i select a turf from
        Make_Nes_Turf()
set category = "Building"
var/newtype = input("What type?")in typesof(/turf/nes/nes)+"Cancel"
if(newtype == "Cancel")
it doesent build when i click the turf i want to build on.
problem 2 when i use flood mode (like flood in ms paint) when it replaces a group of turfs it only floods south of my mouse pointer.


here is the code, just post on which one you can help me with.
turf/Click()
if(usr.building && usr.buildmethod == "Click")
new usr.buildtype (src)
turf/Click()
if(usr.building&&usr.buildmethod =="Flood")
for(var/turf/T in block(locate(1,1,usr.z),locate(100,100,usr.z)))
if(T.type == src.type)
new usr.buildtype(T))



If you dont understand just tell me so i can explain it better.
> turf/Click()
> if(usr.building && usr.buildmethod == "Click")
> new usr.buildtype (src)
> turf/Click()
> if(usr.building&&usr.buildmethod =="Flood")
> for(var/turf/T in block(locate(1,1,usr.z),locate(100,100,usr.z)))
> if(T.type == src.type)
> new usr.buildtype(T))

What is usr.building, usr.buildmethod, usr.buildtype, and how the hell works new usr.buildtype(T))???
In response to CIB
mob
var
buildtype
building = 0
buildmethod


mob
verb
Make_object()
var/newtype = input("What type?")in typesof(/obj)+"Cancel"
set category = "building"
usr.buildtype = newtype
if(newtype == "Cancel")
return
Make_mob()
set category = "Building"
var/newtype = input("What type?")in typesof(/mob/monster)+"Cancel"
usr.buildtype = newtype
if(newtype == "Cancel")
return


Make_Area()
set category = "Building"
var/newtype = input("What type?")in typesof(/area)+"Cancel"
usr.buildtype = newtype
if(newtype == "Cancel")
return


Make_Nes_Turf()
set category = "Building"
var/newtype = input("What type?")in typesof(/turf/nes/nes)+"Cancel"
usr.buildtype = newtype
if(newtype == "Cancel")
return
Make_Snes_Turf()
set category = "Building"
var/newtype = input("What type?")in typesof(/turf/snes/snes)+"Cancel"
usr.buildtype = newtype
if(newtype == "Cancel")
return

ChooseTurfMode()
set category = "Building"
usr.building = 1
usr.buildmethod = input("Select your method to build")in list("Click","Block","Flood","Drag")+"Cancel"
stopbuild()
set category = "Building"

usr.building = 0
usr.MouseEntered(null,null)


turf/Click()
if(usr.building && usr.buildmethod == "Click")
new usr.buildtype (src)


turf
MouseDrag(typea,unused,location)
if(usr.building && usr.buildmethod == "Drag")
typea = usr.buildtype
new typea(location)
turf/MouseDrop(turf/a,turf/b)
if(usr.building && usr.buildmethod == "Block")
var/pword
if(usr.buildtype in typesof(/obj/door))
pword = input("What will the password be?")
for(var/turf/T in block(a,b))
var/atom/A = new usr.buildtype(T)
if(istype(A,/obj/door))
var/obj/door/D = A
D.pword=pword
turf/Click()
if(usr.building&&usr.buildmethod =="Flood")
for(var/turf/T in block(locate(1,1,usr.z),locate(100,100,usr.z)))
if(T.type == src.type)
new usr.buildtype(T)



thats the whole code.


In response to Thedarkavenger
Next time when you cut and paste, cause you accidently used wrong key dont forget dm lol
Big code, some minutes plz.
In response to CIB
sorry lol
In response to Thedarkavenger
Only problem i found yet, is that a return at the end of the proc probably won't help...
        Make_Snes_Turf()
set category = "Building"
var/newtype = input("What type?")in typesof(/turf/snes/snes)+"Cancel"
if(newtype == "Cancel")
return
usr.buildtype = newtype

I can't find a problem with that flood proc... and for the nes I can only imagine that it has to do something with the nes object itself, if the other objects work...
In response to CIB
I added the nes to the wrong place when i posted the message (i edited it), I want the flood verb to flood exactly like ms paint. The modes are fine.
In response to Xx Dark Wizard xX
With your floodproc it wouldn't work anyway. It'd fill just all tiles from same type.
Btw. you used other key again XD
In response to CIB
lol ( feels stupid), that how i want the flood to work. to "replace turfs"
In response to Thedarkavenger
turf/Click()
if(usr.building&&usr.buildmethod =="Flood")
for(var/turf/T in oview(src,1))
if(src.type==T.type)
new usr.buildtype(src.loc)
T.flood_around(src.type,usr.buildtype)
del(T)
del(src)


turf/proc/flood_around(tp,replace)
for(var/turf/T in oview(src,1))
if(T:type==tp)
new replace(src.loc)
T.flood_around(tp,replace)
del(T)

THAT's like ms paint ^^
In response to CIB
building.dm:107: Inconsistent indentation.
building.dm:108: Inconsistent indentation.
building.dm:109: Inconsistent indentation.
In response to Thedarkavenger
... You should be intelligent enough to fix that urself.
In response to CIB
lemme try
In response to Thedarkavenger
I've been trying but, i still doesent compile. It looks good but it doesent work.
In response to Thedarkavenger
turf/Click()
if(usr.building&&usr.buildmethod =="Flood")
for(var/turf/T in oview(src,1))
if(src.type==T.type)
new usr.buildtype(src.loc)
T.flood_around(src.type,usr.buildtype)



turf/proc/flood_around(tp,replace)
for(var/turf/T in oview(src,1))
if(T:type==tp)
new replace(src.loc)
T.flood_around(tp,replace)


i fixed the indentation but i get runtime errors

<font color = red>runtime error: bad loc
proc name: Click (/turf/Click)
source file: building.dm,98
usr: Xx Dark Wizard xX (/mob)
src: the redcobble (10,10,1) (/turf/nes/nes/redcobble)
call stack:
the redcobble (10,10,1) (/turf/nes/nes/redcobble): Click(the redcobble (10,10,1) (/turf/nes/nes/redcobble))
</font>
In response to Thedarkavenger
Regular Click() mode doesent build also
In response to Thedarkavenger
turf/proc/flood_around(tp,replace)
for(var/turf/T in list(get_step(src,NORTH),get_step(src,SOUTH),get_step(src,EAST),get_step(src,WEST))
if(istype(T,tp))new replace(src)
T.flood_around(tp,replace)

You call that like:
flood_around(/turf/grass,/turf/sand)
In response to Ol' Yeller
that only floods turfs around you, typesof would be better. I need it exactlt like ms paint. I also want my click-build to work.
In response to Ol' Yeller
Author: Ol' Yeller [Posts]
Date: 6/25/05 2:23 pm
Topic: Re: building
Post [link]
Parent [link]
Next [link]

turf/proc/flood_around(tp,replace)
for(var/turf/T in list(get_step(src,NORTH),get_step(src,SOUTH),get_step(src,EAST),get_step(src,WEST))
if(istype(T,tp))
new replace(src)
T.flood_around(tp,replace)

It may only go on flooding around when it's same type.
Try this code, and if it doesn't work tell us.


In response to CIB
if(usr.building&&usr.buildmethod =="Flood")

add that


it' isnt compilinng
Page: 1 2