ID:145738
 
Probly a millions things wrong with this proc. lol
Code:
mob
proc
Fire(var/N as num, var/obj as text)
var/F
var/I
if(N == 0) F = new /obj/Attack/Missile/FireBall(usr.loc)
else
for(I = 0, I< N, I++)
if(usr.dir == SOUTH)
F = new text2path("/obj/Attack/Missile/[obj]") (locate(usr.x+ N, usr.y, usr.z))
walk(F,usr.dir,1)


Problem description:

~I know your not supposed to use usr in procs. I'm just using it until I get it mainly working, so chill all you usr abuser bashers.~

When calling Fire(), its intiated like so : Fire(#, name) Number of objects to be fired and name of object to be fired, so I can use it for every kind of misile launching verb.

Putting text2path() after new gives me an error:
text2path: undefined var

How can I fix this?
Mechanios wrote:
~I know your not supposed to use usr in procs. I'm just using it until I get it mainly working, so chill all you usr abuser bashers.~

No. Never abuse usr for any reason, especially until you get something working. How can you tell it's working if you're harboring a bug? Do it right the first time. Optimization is what you do after you get something working, not fixing basic mistakes.

When calling Fire(), its intiated like so : Fire(#, name) Number of objects to be fired and name of object to be fired, so I can use it for every kind of misile launching verb.

Putting text2path() after new gives me an error:
text2path: undefined var

How can I fix this?

You can't use an expression directly in new() for the type path like that; hence the error. DM thinks you're trying to create a new object whose type path is stored in a var called text2path, and its location should be "/obj/Attack/Missile/[obj]"). It'll also freak out on the locate() folowing that.

You need to fill a var with the result of text2path(), and use that in new(). Or, you can just put the string in a var and not use text2path() at all, since new() understands strings as well.

I also highly recommend you do not name the second argument obj. Call it O or something. obj is a special keyword in DM; you should not use it for a var name.

Also, you should be using get_step() instead of an if/else block with the different directions.

And above all: No put usr in proc! Ungh!

Lummox JR
Mechanios wrote:
~I know your not supposed to use usr in procs. I'm just using it until I get it mainly working, so chill all you usr abuser bashers.~

A) How will you know it's working if you're keeping it bug-prone? Maybe it won't work right and the reason will be you keeping usr. And the switch from usr to src in there isn't even a hard one---just take the 'usr.' off each variable prefix and you should be good.

Hiead
In response to Lummox JR
<QUOTE>
You can't use an expression directly in new() for the type path like that; hence the error. DM thinks you're trying to create a new object whose type path is stored in a var called text2path, and its location should be "/obj/Attack/Missile/[obj]"). It'll also freak out on the locate() folowing that.
</QUOTE>

I've run into that, too, and I'd swear that it's new behaviour.

I'm sure I've done something similar to that before (Combining new with pick) and had it work, but now I need to store it in a variable.

Ah well, it's nothing major.
In response to Jp
All fixed up, and thanks for the help. =D
From now on when I send Fire() I'll put the num and then the path of the object to be fired.
In response to Jp
Jp wrote:
I've run into that, too, and I'd swear that it's new behaviour.

And you'd be wrong!

I'm sure I've done something similar to that before (Combining new with pick) and had it work, but now I need to store it in a variable.

You have not. It's always been this way.

Lummox JR
In response to Lummox JR
I always knew I was delusional. :P