ID:173452
 
This is really frustrating, why am I getting these errors?


obj/+1-Attack
icon = 'x2attack.dmi'
icon_state = "1attack"
verb/use()
usr << "You use the [src]!"
usr.Min_Attack + 1
usr.Max_Attack * 1
del(src) //Delete the stat modifier(src)
verb/get()
set src in oview(1)
usr.contents + new /obj/+1-Attack
usr << "You picked up a +1 Attack!"
del(src)

stat increasers.dm:4:error:obj/:duplicate definition
stat increasers.dm:4:error:1:duplicate definition
stat increasers.dm:4:error:+ :instruction not allowed here
stat increasers.dm:4:error::duplicate definition
stat increasers.dm:4:error:Attack:undefined type
stat increasers.dm:5:error:'x2attack.dmi':cannot find file
stat increasers.dm:7:error:verb/recieve:duplicate definition
stat increasers.dm:8:error:usr:duplicate definition
stat increasers.dm:8:error:src:value not allowed here
stat increasers.dm:8:error::empty type name (indentation error?)
stat increasers.dm:8:error:text "You use the []!":value not allowed here
stat increasers.dm:8:error::duplicate definition
stat increasers.dm:8:error:<< :instruction not allowed here
stat increasers.dm:9:error:usr.Min_Attack:duplicate definition
stat increasers.dm:9:error:1:duplicate definition
stat increasers.dm:9:error:+ :instruction not allowed here
stat increasers.dm:10:error:usr.Max_Attack:duplicate definition
stat increasers.dm:10:error:1:duplicate definition
stat increasers.dm:10:error:* :instruction not allowed here
stat increasers.dm:11:error:src:value not allowed here
stat increasers.dm:11:error:del :instruction not allowed here
stat increasers.dm:8:error::duplicate definition
stat increasers.dm:12:error:verb/grab:duplicate definition
stat increasers.dm:13:error:src:duplicate definition
stat increasers.dm:13:error:1:value not allowed here
stat increasers.dm:13:error::duplicate definition
stat increasers.dm:13:error:in :instruction not allowed here
stat increasers.dm:14:error:usr.contents:duplicate definition
stat increasers.dm:14:error:/obj/:value not allowed here
stat increasers.dm:14:error:new :instruction not allowed here
stat increasers.dm:14:error::duplicate definition
stat increasers.dm:14:error:1:duplicate definition
stat increasers.dm:14:error:+ :instruction not allowed here
stat increasers.dm:14:error::duplicate definition
stat increasers.dm:14:error:Attack:duplicate definition
stat increasers.dm:15:error:usr:duplicate definition
stat increasers.dm:15:error:"You picked up a +1 Attack!":duplicate definition
stat increasers.dm:15:error:<< :instruction not allowed here
stat increasers.dm:16:error:src:value not allowed here
stat increasers.dm:16:error:del :instruction not allowed here
stat increasers.dm:13:error::duplicate definition


This is for that dynasty Warriors Game.
Names of objs must start with a letter.
In response to Jon88
Well now I have:


obj
Attackplus1
icon = 'x2 attack.dmi'
icon_state = "1attack"
verb/use()
usr << "You use the [src]!"
usr.Min_Attack + 1
usr.Max_Attack + 1
del(src) //Delete the stat modifier(src)
verb/get()
set src in oview(1)
usr.contents ++ new /obj/Attackplus1
usr << "You picked up a +1 Attack!"
del(src)


stat increasers.dm:15:error: new: expected end of statement
In response to Nave
Nave wrote:
Well now I have:


obj
Attackplus1
icon = 'x2 attack.dmi'
icon_state = "1attack"
verb/use()
usr << "You use the [src]!"
usr.Min_Attack + 1
usr.Max_Attack + 1
del(src) //Delete the stat modifier(src)
verb/get()
set src in oview(1)
usr.contents ++ new /obj/Attackplus1
usr << "You picked up a +1 Attack!"
del(src)


stat increasers.dm:15:error: new: expected end of statement

Let's break it down.

usr.contents ++ new /obj/Attackplus1//Line with the problem

The problem is the ++ operator. That is used to add one to a variable. It is used like this (taken directly from the handy F1 key).
var/A
world << "A++ = [A++]" // outputs "A++ = 0"
world << "++A = [++A]" // outputs "++A = 2"

What you are looking to do is add an object to the player's inventory. That is done with the += operator. += is shorthand for A=A+B. Your problem will be easily solved by replacing ++ with +=.

In response to HavenMaster
Or, even better, remove the del(src) part, and use
Move(usr)

You can even have if(Move(usr)) to do soemthing if you can't pick it up, and then handle a limited inventory size with mob/Enter():
mob
Enter(atom/movable/A)
if(contents.len >= strength)
return 0
else
return 1
In response to Garthor
ok I understand that makes alot of sense but now I get


stat increasers.dm:10:+ :warning: statement has no effect
stat increasers.dm:11:+ :warning: statement has no effect
In response to Nave
Nave wrote:
ok I understand that makes alot of sense but now I get


stat increasers.dm:10:+ :warning: statement has no effect
stat increasers.dm:11:+ :warning: statement has no effect


Earlier Nave wrote:
usr.Min_Attack + 1
usr.Max_Attack + 1
Ok, either use:
                          usr.Min_Attack ++
usr.Max_Attack ++
or
usr.Min_Attack += 1
usr.Max_Attack += 1
In response to Nave
Nave wrote:
ok I understand that makes alot of sense but now I get


stat increasers.dm:10:+ :warning: statement has no effect
stat increasers.dm:11:+ :warning: statement has no effect

Could you show us what your snippet looks like now? That would definitely help.
In response to HavenMaster

obj
Attackplus1
icon = 'x2 attack.dmi'
icon_state = "1attack"
verb/use()
usr << "You use the [src]!"
usr.Min_Attack + 1
usr.Max_Attack + 1
del(src) //Delete the stat modifier(src)
verb/get()
set src in oview(1)
usr.contents += new /obj/Attackplus1
usr << "You picked up a +1 Attack!"
del(src)
In response to Nave
Nave wrote:
obj
Attackplus1
icon = 'x2 attack.dmi'
icon_state = "1attack"
verb/use()
usr << "You use the [src]!"
usr.Min_Attack + 1
usr.Max_Attack + 1
del(src) //Delete the stat modifier(src)
verb/get()
set src in oview(1)
usr.contents += new /obj/Attackplus1
usr << "You picked up a +1 Attack!"
del(src)

Ok, from what everyone has been trying to tell you, you want this:
obj
Attackplus1
icon = 'x2 attack.dmi'
icon_state = "1attack"
verb/use()
usr << "You use the [src]!"
usr.Min_Attack += 1 //or usr.Min_Attack ++
usr.Max_Attack += 1 //or usr.Max_Attack ++
del(src) //Delete the stat modifier(src)
verb/get()
set src in oview(1)
src.Move(usr)
usr << "You picked up a +1 Attack!"
In response to Evil Incarnate Inc
Or, even better:
obj
Attackplus1
icon = 'x2 attack.dmi'
icon_state = "1attack"
verb/use()
usr << "You use the [src]!"
usr.Min_Attack += 1 //or usr.Min_Attack ++
usr.Max_Attack += 1 //or usr.Max_Attack ++
del(src) //Delete the stat modifier(src)
verb/get()
set src in oview(1)
if(src.Move(usr))
usr << "You picked up a +1 Attack!"


That way, you can limit how many objects you can carry by modifying the mob/Enter(atom/movable/A) proc, which will be called every time you try to pick something up, so that you can allow or disallow pickuppage by returning 1 or 0.
In response to Garthor
Hi, thank you guys very much, but I just rembered that in Dynasty Warriors when you get a +1 Attack it automatically uses it. How would I do this?


Thanks,
Nave
In response to Nave
Wait I just got a bunch of errors when I put that code in....again.


combat.dm:181: unterminated text (expecting ")
combat.dm:182:error: stat: missing comma ',' or right-paren ')'
combat.dm:182:error: stat: expected end of statement
combat.dm:217:warning: empty 'else' clause
combat.dm:221:warning: empty 'else' clause
combat.dm:225:warning: empty 'else' clause
combat.dm:229:warning: empty 'else' clause
combat.dm:232:warning: empty 'else' clause
combat.dm:235:warning: empty 'else' clause
combat.dm:238:warning: empty 'else' clause
combat.dm:247:warning: empty 'else' clause
Dynasty Warriors Online.dm:32:warning: empty 'else' clause
Dynasty Warriors Online.dm:89:warning: empty 'else' clause
Dynasty Warriors Online.dm:92:warning: empty 'else' clause
GM.dm:17:error: proc definition not allowed inside another proc

Dynasty Warriors Online.dmb - 4 errors, 11 warnings (double-click on an error to jump to it)
In response to Nave
Nave wrote:
Hi, thank you guys very much, but I just rembered that in Dynasty Warriors when you get a +1 Attack it automatically uses it. How would I do this?

obj
Attackplus1
icon = 'x2 attack.dmi'
icon_state = "1attack"
verb/get()
set src in oview(1)
usr << "You picked up a +1 Attack!" //Tell you that you got it
usr.Min_Attack ++ //Add 1 to your Min Attack
usr.Max_Attack ++ //Add 1 to your Max Attack
del src //Delete the item


Basically, just delete the item, and do what you had for the use verb (adding the stats).
In response to Evil Incarnate Inc
del(src) will stop the current proc/verb, because what it was running on is gone. That's why you don't get errors when there's a loop running but you delete the object the loop was running on.
In response to Nave
Dude, fixing errors really isn't that tough.

combat.dm:181: unterminated text (expecting ")

that means on line 181 of your combat dm, you need to add quotes. again...

combat.dm:182:error: stat: missing comma ',' or right-paren ')'

that means, on line 182 you have an unbalanced set of parentheses, apostrophes, or some other grouping symbol. Maybe if you took the time to try fixing some errors by yourself, we wouldn't have to take you through this step by step. As they say, it's good to learn from your mistakes.
In response to Tolooky
I can not fix these errors because there is nothing wrong. Please help.
In response to Nave
stat("Defense: ","[Defense]")



.......I do not see a error on that line.......for line 182
In response to Tolooky
Tolooky wrote:
combat.dm:182:error: stat: missing comma ',' or right-paren ')'

that means, on line 182 you have an unbalanced set of parentheses, apostrophes, or some other grouping symbol. Maybe if you took the time to try fixing some errors by yourself, we wouldn't have to take you through this step by step. As they say, it's good to learn from your mistakes.

Actually, the line that's actually getting the error is the line above the one it reports, so the unbalanced paren in most likely on 181.

~>Volte
In response to Volte
i fixed 181 and 182 still has a error.
Page: 1 2