ID:1899603
 
(See the best response by Ter13.)
Code:
mob/verb

BasicAttack()
name = "Basic Attack"
icon_state = ""
description = "Deals damage to a single melee target."
animation = "attacking"
cooldown = 40

can_use(mob/user)
if(user.on_cooldown("melee-attack", "attack"))
//This line causes the error ^
return 0

var/mob/target = user.melee_target()
if(!target)
user.no_target_selected(src)
return 0

return ..()

effect(mob/user)

var/mob/target = user.melee_target()

user.cooldown("melee-attack", cooldown)
user.cooldown("attack", 10)

PhysicalCombat.attack(user, target, 5 + user.power)
target.effect("dagger-slash")
target.noise('hit-1.wav', frequency = rand(0.7, 1.3))


When I try to compile this I get an error of;

error: proc definition not allowed inside another proc

I am using the action rpg framework and i'm trying to change the abilities into verbs instead of procs

I was wondering if anyone has attempted to do this before and if they had any success, is possible I wanna try and keep the current ability system just instead of binding abilities to keys you start them with a verb.

Thanks in advance!
Best response
can_use() and effect() are inside of BasicAttack(). You can't define procs inside of procs.

Not much more to say than that other than remove the tabs.

mob/verb

BasicAttack()
name = "Basic Attack"
icon_state = ""
description = "Deals damage to a single melee target."
animation = "attacking"
cooldown = 40

mob
proc
can_use(mob/user)
if(user.on_cooldown("melee-attack", "attack"))
//This line causes the error ^
return 0

var/mob/target = user.melee_target()
if(!target)
user.no_target_selected(src)
return 0

return ..()

effect(mob/user)

var/mob/target = user.melee_target()

user.cooldown("melee-attack", cooldown)
user.cooldown("attack", 10)

PhysicalCombat.attack(user, target, 5 + user.power)
target.effect("dagger-slash")
target.noise('hit-1.wav', frequency = rand(0.7, 1.3))
Also, I should mention that what you are doing isn't going to work like you think it will. Trying to turn an object into a verb is very silly.
Yeah, the obj setup has certain advantages, like the fact that you have procs such as can_use() and effect() that can be overridden. Sounds like you're trying to replace a robust design with a less robust one.