mob
verb
Kill_Bunshins()
set category = "Commands"
for(var/mob/clone)
if(src.bunshinclone >= 1)
del(clone)
I get a invalid or missing expression error
ID:146588
Apr 26 2005, 2:16 pm
|
|
Clone
mob I get a invalid or missing expression error |
In response to Ryne Rekab
|
|
Ryne Rekab wrote:
Next time comment the line. But you are missing the ) on the for() statement. umm I don't see that,anyway I want it to delete the bunshin clones that the player has made. mob/proc Heres the full code. |
In response to Broly103
|
|
Kill_Bunshins() has an indentation issue.
You're abusing usr in your proc. Read the usr lecture. The following line: var/mob/clone=new(usr.loc) Even if the usr abuse is fixed here: var/mob/clone=new(src.loc) A mob's loc variable is going to be a turf: not a mob! What you're doing, telling the program to think of a turf as a mob, is pretty dangerous: you're just asking for trouble. Also, your for list should look something like this: for(var/mob/clone in world) |
In response to Wizkidd0123
|
|
Wizkidd0123 wrote:
Kill_Bunshins() has an indentation issue. var/mob/clone=new(usr.loc) Even if the usr abuse is fixed here: var/mob/clone=new(src.loc) A mob's loc variable is going to be a turf: not a mob! What you're doing, telling the program to think of a turf as a mob, is pretty dangerous: you're just asking for trouble.The indentation was an error while I was typing,I still don't get why it won't kill my clones. for(var/mob/clone in world) |
In response to Broly103
|
|
Broly103 wrote:
The indentation was an error while I was typing,I still don't get why it won't kill my clones. Fix everything that I told you to fix before telling me that it doesn't work. If it still doesn't work then, then please post the updated, fixed code. |
In response to Wizkidd0123
|
|
Wizkidd0123 wrote:
Broly103 wrote: oh XD, I do not know how to fix the new=(src.loc).But Putting clone in world, that will kill every clone in the world o_O. I just want it to kill in the src clones.The clone problem that I get is it says missing expression. |
In response to Broly103
|
|
Broly103 wrote:
oh XD, I do not know how to fix the new=(src.loc). Depends what you want the clone to represent. If you just want a completely new mob, then you're looking for: var/mob/clone = new() But Putting clone in world, that will kill every clone in the world o_O. I just want it to kill in the src clones.The clone problem that I get is it says missing expression. In that case, you need to give the clone an owner variable: clone.owner = src.ckey Then, you can search for a specific player's clones like this: for(var/mob/clone in world) |
In response to Wizkidd0123
|
|
Wouldn't it be better to add the clones to a list on creation?
mob/var/list/Clones=new -Ryan |
In response to Ryne Rekab
|
|
Ryne Rekab wrote:
Wouldn't it be better to add the clones to a list on creation? Perhaps, but as to your code:
|
In response to Wizkidd0123
|
|
Wizkidd0123 wrote:
The following line: var/mob/clone=new(src.loc) A mob's loc variable is going to be a turf: not a mob! What you're doing, telling the program to think of a turf as a mob, is pretty dangerous: you're just asking for trouble. Sorry! I was totally and completely wrong there! The line should be //Create a new mob on the same turf as the player Sorry if I've caused you any confusion! (I was thinking of a different language when I wrote that =P) |
In response to Wizkidd0123
|
|
Wizkidd0123 wrote:
Wizkidd0123 wrote: var/mob/clone=new(src.loc) A mob's loc variable is going to be a turf: not a mob! What you're doing, telling the program to think of a turf as a mob, is pretty dangerous: you're just asking for trouble. > //Create a new mob on the same turf as the player Sorry if I've caused you any confusion! (I was thinking of a different language when I wrote that =P)Its okay XD, I tried all I could still can not kill bunshins. |
-Ryan