ID:270309
 
mob
verb
Level_Up()
set category = "Mod"
proc/Levelup

just putting the proc wont run it it gives me 2 warnings and an error

Levelup :warning unused label
proc :warning unused label
error: missing expression
Dragon_fire6653 wrote:
mob
verb
Level_Up()
set category = "Mod"
proc/Levelup

No... like this.

mob
verb
Level_Up()
set category = "Mod"
var/mob/M = input("Choose one:", "Leveling up") as mob in world
Levelup(M)

Try that.



--Vito
//if its for the world or anything in general.

proc/Levelup()
//do everything here

//a proc without anything in front of it is just a world proc
//its is not specified for anything

Levelup() //is how it would be called

//but for mobs or objs...

usr.Levelup()
src.Levelup()
//or a var for the player like X, would be X.levelup()
//so in your case

mob
verb
Level_Up()
set category = "Mod"
usr.LevelUp() // <- is how it would be called
In response to Pyro_dragons
You can't have a caller for a global proc. To do what you want, you either need to include an argument, or make the proc under a different type path.

proc/LevelUp(mob/M)  //Your global Level Up() proc with an argument

mob/verb/Level_Up()
set category="Mod"
LevelUp(src) //This is how you would call it so the argument requirement for Level Up() is filled.

////// Or you can just do it this way, which requires no argument

mob/proc/LevelUp() //Your Level Up() proc without an argument and under a different type path

mob/verb/Level_Up()
set category="Mod"
src.LevelUp() //Or just "LevelUp()". This is how you would call it when there is no arguement required, and it's under the same type path. (The clicker and the proc)
In response to Pyro_dragons
neither way will work
Don't think it uncharitable to point this out, but: ID:438723. I think this thread pretty well proves you need to cover a lot more ground before you start writing demos. I recommend hitting the DM Guide pretty hard.

It's a good idea to write something for your own purposes, of course, so you can learn and then use that technique in your own games. However, if you want to publish an actual demo for other people to see, always run it by people who have some experience. For future reference.

Lummox JR
In response to Vito Stolidus
Vito Stolidus wrote:
No... like this.
mob
verb
Level_Up()
set category = "Mod"
var/mob/M = input("Choose one:", "Leveling up") as mob in world
Levelup(M)

Try that.

Or better yet, not. So very wrong.

A levelup proc should never take an argument, because it never needs one. All such a proc needs is src, the mob leveling up. The correct way to call a levelup proc, therefore, is M.Levelup().

Lummox JR
In response to Lummox JR
for some reason the code that was given by anyone didnt raise my level so i added
level += 1 to the end. Like this:


proc/LevelUp(mob/M in world)  //Your global Level Up() proc with an argument

mob/verb/Level_Up()
set category="Mod"
LevelUp(src) //This is how you would call it so the argument requirement for Level Up() is filled.
Level += 1
In response to Lummox JR
Oh, sorry. forgot. You're right.

--Vito
In response to Mxjerrett
Mxjerrett wrote:
for some reason the code that was given by anyone didnt raise my level so i added level += 1 to the end.

Gads no. The levelup() proc is supposed to do that part, not the verb that calls it.

Lummox JR
In response to Lummox JR
well for some reason it doesnt
In response to Mxjerrett
Why the hell do you pass an argument into Level() anyway.
In response to Mxjerrett
Mxjerrett wrote:
well for some reason it doesnt

That's correct, because it was never put there. If you want to increment the level var, do it inside the levelup() proc, not outside. That's what the proc is for, after all. Common sense must be applied to these things.

Lummox JR