ID:155330
 
Hey everyone. Namone again...RobertBanks and Lugia helped me last night and the result was this code.

    log
verb/Build_Fire()
set src in usr
var/obj/fire/F = new /obj/fire(get_step(usr,usr.dir))
usr << "[usr] kindled a fire."
spawn()F.timer(1000)
del src




However, I have ran into a few issues. I want to be able to craft say a chair, but I want it to require more than one piece of wood. I tried this code, but I get errors.

    log
verb/Build_Fire()
set src in usr
var/obj/fire/F = new /obj/fire(get_step(usr,usr.dir))
usr << "[usr] kindled a fire."
spawn()F.timer(1000)
del src

log
verb/Build_Chair()
if(usr.log >= 2)
set src in usr
var/obj/item/chair/C = new/obj/item/chair(get_step(usr,usr.dir))
usr << "[usr] built a quaint chair."
spawn(C)










obj/fire

icon = 'icon.dmi'
icon_state = "fire"
luminosity = 3
density = 1

proc/timer(length)
sleep(length)
del src

obj/item
chair
icon = 'icon.dmi'
icon_state = "chair"
density = 0


The Chair code I am working on is the one with the verb Build_chair().

Anyway when I compile I get these errors.


loading RP.dme
Objects.dm:47:error: obj.log: undefined var
Objects.dm:62:error: : invalid expression

RP.dmb - 2 errors, 0 warnings (double-click on an error to jump to it)



Line 62 is the obj/fire line. and error 47 is the (usr.log >= 2) in the build_chair() verb.


Thanks for your help,


Namone




"set" has to be at the beginning of a proc/verb.
In response to Megablaze
Megablaze wrote:
"set" has to be at the beginning of a proc/verb.


There is no proc/verb in my coding.
In response to Namone
I am also unsure what the "Invalid Expression" error is refering too....
In response to Namone
Pretty sure you do have a set

    log
verb/Build_Chair()
if(usr.log >= 2)
set src in usr
var/obj/item/chair/C = new/obj/item/chair(get_step(usr,usr.dir))
usr << "[usr] built a quaint chair."
spawn(C)


set src in usr should be tabbed with if(usr.log >= 2)
Where is usr.log defined? I didn't see you mob code here, so that's something to double-check. Also, I don't think it's an error, but it's bad practice to use the same expressions for variables and datum/object types. There is the possibility for confusion when "log" means more than one thing.