ID:141476
 
Code:
mob
verb
Swift()
skillname = "Swift"
if(usr.Swift == 1)
return 0
else if(usr.Swift == 2)
usr<<"You must wait before you can use this skill again!"
else if(usr.Swift == 0)
usr<<"You feel faster than before."
usr.rundelay = 2
usr.Swift = 1
sleep(100) // Your speed is 2 for 10 seconds.
usr.rundelay = 6 // Return ...
usr<<"You feel normal, again."
usr.Swift = 2
sleep(600) // 1 minute cooldown.
usr.Swift = 0
Recover()
skillname = "Recover"
if(usr.Recover == 1)
return 0
else if(usr.Recover == 2)
usr<<"You must wait before you can use this skill again!"
else if(usr.Recover == 0)
return // Not coded in yet.


Problem description:
No problem, but I just want to know if there is an easier way to do skills like this.
This is how I would go about it.

mob
verb
Swift()
skillname = "Swift"
switch(src.Swift)
if(2)
src<<"You must wait before you can use this skill again!"
if(0)
src<<"You feel faster than before."
src.rundelay = 2
src.Swift = 1
sleep(100) // Your speed is 2 for 10 seconds.
src.rundelay = 6 // Return ...
src<<"You feel normal, again."
src.Swift = 2
sleep(600) // 1 minute cooldown.
src.Swift = 0
Recover()
skillname = "Recover"
switch(src.Recover)
if(2)
src<<"You must wait before you can use this skill again!"
if(0)
return // Not coded in yet.


Basically, what I did was took all usr out because in verbs and procs, it is more often than not (about 99% of the time) frowned upon. I also changed your else if statements into a simple switch procedure, and that's about it. I also removed the if(1) lines because they were redundant.

Hope it helps.
Best possible thing is to have a variable that says if it can attack or not(ie: mob/var/canattack=1) And i'm sure you'll have other variables as well when checking if they can attack, so you'd make a proc like this below;
mob/proc/CanAttack()
if(canattack)//if it can attack(Add other variables here aswell
return 1//Passs
else //If it can't attack
return 0//Fail

Then you would execute that proc like this in your verbs;
mob
verb
Swift()
skillname = "Swift"
if(CanAttack())//Checks all variables to see if it can attack with the proc
//... Rest of code if it can attack
else
//... Rest of code if it can't attack


With that you can easily edit variables to check if it can or can't attack so you don't have to edit every single attack when you do it. Cause having a variable for every attack is a little extreme when you could use a lot less. If you want more on this look up Modular Programming, there are tutorials about it in Dream Makers and on the web.
Personally, I would first create a list named "locked_tech" or something, then add the name of the tech when it's cooling down and check to see if it's in the list by calling a proc.

mob
var/tmp
list/locked_tech = list()

proc
Process(_name)
return (_name in locked_tech) ? 0 : 1 // if the name is in the list, then return 0(false)

Lock_tech(_name, _time)
locked_tech += _name
spawn(_time)
locked_tech -= name

verb
Speed()
if( !(Process("Speed")) ) // call the proc
src << "You can't use this yet,"
else
src << "You feel faster"
src.move_delay -= 2
spawn(100)
src << "You return to your normal speed"
src.move_delay = 4
Lock_tech("Speed", 300) // lock the tech for 30 seconds
You should probably use datums and inheritance if you have a lot of repetitive code. Otherwise, follow something along the lines of what Axerob did.