ID:262874
 
Code:
This is the DM File:
/*
* Macros: A quick little demo from Deadron.
#
* To have single-character macros in BYOND, the key is to make an entry in the Macros.dms
* file for any key you want to support. The macro causes a verb to be called.
*
* We provide a client verb for each possible command, which calls the client.Input() proc
* letting it know what letter the player pressed. client.Input() either processes it
* or passes the input to the selected object's Input() proc.
*
* In this demo, each verb calls a client.Input() proc, which either processes the command
* or passes it to the selected object's Input() proc to process.
*
*/



client
command_text = ".alt " // macro mode

proc/Input(letter)
// If it's a global command, handle it.
// Otherwise pass it to the selected object to handle.
switch(letter)
if ("a") A()
if ("w") W()
if ("s") S()
if ("d") D()
if("space")Space()

// These are the verbs that get called by the macros.
verb/a()
set hidden = 1
Input("a")
verb/b()
set hidden = 1
Input("b")
verb/c()
set hidden = 1
Input("c")
verb/d()
set hidden = 1
Input("d")
verb/e()
set hidden = 1
Input("e")
verb/f()
set hidden = 1
Input("f")
verb/g()
set hidden = 1
Input("g")
verb/h()
set hidden = 1
Input("h")
verb/i()
set hidden = 1
Input("i")
verb/j()
set hidden = 1
Input("j")
verb/k()
set hidden = 1
Input("k")
verb/l()
set hidden = 1
Input("l")
verb/m()
set hidden = 1
Input("m")
verb/n()
set hidden = 1
Input("n")
verb/o()
set hidden = 1
Input("o")
verb/p()
set hidden = 1
Input("p")
verb/q()
set hidden = 1
Input("q")
verb/r()
set hidden = 1
Input("r")
verb/s()
set hidden = 1
Input("s")
verb/t()
set hidden = 1
Input("t")
verb/u()
set hidden = 1
Input("u")
verb/v()
set hidden = 1
Input("v")
verb/w()
set hidden = 1
Input("w")
verb/x()
set hidden = 1
Input("x")
verb/y()
set hidden = 1
Input("y")
verb/z()
set hidden = 1
Input("z")
verb/space()
set hidden = 1
Input("space")

















proc/W()
if(!usr.quiditch)return
for(var/obj/o as obj in usr.contents)
if(istype(o,/obj/Items/Quiditch/Quaffle))
o.loc=usr.loc
usr.quaffle=0
walk_to(o,locate(usr.x,usr.y+5,usr.z),5,2)
proc/A()
if(!usr.quiditch)return
for(var/obj/o as obj in usr.contents)
if(istype(o,/obj/Items/Quiditch/Quaffle))
o.loc=usr.loc
usr.quaffle=0
spawn()
walk_to(o,locate(usr.x-5,usr.y,usr.z),,2)
proc/S()
if(!usr.quiditch)return
for(var/obj/o as obj in usr.contents)
if(istype(o,/obj/Items/Quiditch/Quaffle))
o.loc=usr.loc
usr.quaffle=0
walk_to(o,locate(usr.x,usr.y-5,usr.z),,2)
proc/D()
if(!usr.quiditch)return
for(var/obj/o as obj in usr.contents)
if(istype(o,/obj/Items/Quiditch/Quaffle))
o.loc=usr.loc
usr.quaffle=0
walk_to(o,locate(usr.x+5,usr.y,usr.z),5,2)
proc/Space()
if(!usr.quiditch||usr.quaffle)return
for(var/obj/o as obj in oview(1))
if(istype(o,/obj/Items/Quiditch/Quaffle))
o.loc=usr
usr.quaffle=1
return
for(var/mob/m as mob in oview(1))
for(var/obj/o as obj in m.contents)
if(istype(o,/obj/Items/Quiditch/Quaffle))
var/chance=rand(1,round(max(m.overalllev-usr.overalllev,2)/2))
if(chance==1)
var/chance2=rand(1,max(1,round(usr.overalllev/8)))
if(chance2==1)
o.loc=m.loc
m.quaffle=0
else
o.loc=usr
m.quaffle=0
usr.quaffle=1

This is the dms file:
/*
* Macros: A quick little demo from Deadron.
#
* To have single-character macros in BYOND, the key is to make an entry in the Macros.dms
* file for any key you want to support. The macro causes a verb to be called.
*
* We provide a client verb for each possible command, which calls the client.Input() proc
* letting it know what letter the player pressed. client.Input() either processes it
* or passes the input to the selected object's Input() proc.
*
* In this demo, each verb calls a client.Input() proc, which either processes the command
* or passes it to the selected object's Input() proc to process.
*
*/



client
command_text = ".alt " // macro mode

proc/Input(letter)
// If it's a global command, handle it.
// Otherwise pass it to the selected object to handle.
switch(letter)
if ("a") A()
if ("w") W()
if ("s") S()
if ("d") D()
if("space")Space()

// These are the verbs that get called by the macros.
verb/a()
set hidden = 1
Input("a")
verb/b()
set hidden = 1
Input("b")
verb/c()
set hidden = 1
Input("c")
verb/d()
set hidden = 1
Input("d")
verb/e()
set hidden = 1
Input("e")
verb/f()
set hidden = 1
Input("f")
verb/g()
set hidden = 1
Input("g")
verb/h()
set hidden = 1
Input("h")
verb/i()
set hidden = 1
Input("i")
verb/j()
set hidden = 1
Input("j")
verb/k()
set hidden = 1
Input("k")
verb/l()
set hidden = 1
Input("l")
verb/m()
set hidden = 1
Input("m")
verb/n()
set hidden = 1
Input("n")
verb/o()
set hidden = 1
Input("o")
verb/p()
set hidden = 1
Input("p")
verb/q()
set hidden = 1
Input("q")
verb/r()
set hidden = 1
Input("r")
verb/s()
set hidden = 1
Input("s")
verb/t()
set hidden = 1
Input("t")
verb/u()
set hidden = 1
Input("u")
verb/v()
set hidden = 1
Input("v")
verb/w()
set hidden = 1
Input("w")
verb/x()
set hidden = 1
Input("x")
verb/y()
set hidden = 1
Input("y")
verb/z()
set hidden = 1
Input("z")
verb/space()
set hidden = 1
Input("space")

















proc/W()
if(!usr.quiditch)return
for(var/obj/o as obj in usr.contents)
if(istype(o,/obj/Items/Quiditch/Quaffle))
o.loc=usr.loc
usr.quaffle=0
walk_to(o,locate(usr.x,usr.y+5,usr.z),5,2)
proc/A()
if(!usr.quiditch)return
for(var/obj/o as obj in usr.contents)
if(istype(o,/obj/Items/Quiditch/Quaffle))
o.loc=usr.loc
usr.quaffle=0
spawn()
walk_to(o,locate(usr.x-5,usr.y,usr.z),,2)
proc/S()
if(!usr.quiditch)return
for(var/obj/o as obj in usr.contents)
if(istype(o,/obj/Items/Quiditch/Quaffle))
o.loc=usr.loc
usr.quaffle=0
walk_to(o,locate(usr.x,usr.y-5,usr.z),,2)
proc/D()
if(!usr.quiditch)return
for(var/obj/o as obj in usr.contents)
if(istype(o,/obj/Items/Quiditch/Quaffle))
o.loc=usr.loc
usr.quaffle=0
walk_to(o,locate(usr.x+5,usr.y,usr.z),5,2)
proc/Space()
if(!usr.quiditch||usr.quaffle)return
for(var/obj/o as obj in oview(1))
if(istype(o,/obj/Items/Quiditch/Quaffle))
o.loc=usr
usr.quaffle=1
return
for(var/mob/m as mob in oview(1))
for(var/obj/o as obj in m.contents)
if(istype(o,/obj/Items/Quiditch/Quaffle))
var/chance=rand(1,round(max(m.overalllev-usr.overalllev,2)/2))
if(chance==1)
var/chance2=rand(1,max(1,round(usr.overalllev/8)))
if(chance2==1)
o.loc=m.loc
m.quaffle=0
else
o.loc=usr
m.quaffle=0
usr.quaffle=1


Problem description:
Well this worked before, when I had on the other computer. But I transfered it onto this one and I was using an external dms file so I lost it. When I downloaded the macro demo again and used the same dms file in there it didnt work. Mabey its my code but does anyone know how to fix this?

Global procs, usr abuse, copy/pasting.
In response to Mysame
Oops, some problems with that code, here is the code again:

/*
* Macros: A quick little demo from Deadron.
#
* To have single-character macros in BYOND, the key is to make an entry in the Macros.dms
* file for any key you want to support. The macro causes a verb to be called.
*
* We provide a client verb for each possible command, which calls the client.Input() proc
* letting it know what letter the player pressed. client.Input() either processes it
* or passes the input to the selected object's Input() proc.
*
* In this demo, each verb calls a client.Input() proc, which either processes the command
* or passes it to the selected object's Input() proc to process.
*
*/



client
command_text = ".alt " // macro mode

proc/Input(letter)
// If it's a global command, handle it.
// Otherwise pass it to the selected object to handle.
switch(letter)
if ("a") A()
if ("w") W()
if ("s") S()
if ("d") D()
if("space")Space()

// These are the verbs that get called by the macros.
verb/a()
set hidden = 1
Input("a")
verb/b()
set hidden = 1
Input("b")
verb/c()
set hidden = 1
Input("c")
verb/d()
set hidden = 1
Input("d")
verb/e()
set hidden = 1
Input("e")
verb/f()
set hidden = 1
Input("f")
verb/g()
set hidden = 1
Input("g")
verb/h()
set hidden = 1
Input("h")
verb/i()
set hidden = 1
Input("i")
verb/j()
set hidden = 1
Input("j")
verb/k()
set hidden = 1
Input("k")
verb/l()
set hidden = 1
Input("l")
verb/m()
set hidden = 1
Input("m")
verb/n()
set hidden = 1
Input("n")
verb/o()
set hidden = 1
Input("o")
verb/p()
set hidden = 1
Input("p")
verb/q()
set hidden = 1
Input("q")
verb/r()
set hidden = 1
Input("r")
verb/s()
set hidden = 1
Input("s")
verb/t()
set hidden = 1
Input("t")
verb/u()
set hidden = 1
Input("u")
verb/v()
set hidden = 1
Input("v")
verb/w()
set hidden = 1
Input("w")
verb/x()
set hidden = 1
Input("x")
verb/y()
set hidden = 1
Input("y")
verb/z()
set hidden = 1
Input("z")
verb/space()
set hidden = 1
Input("space")
















client
proc/W()
if(!usr.quiditch)return
for(var/obj/o as obj in usr.contents)
if(istype(o,/obj/Items/Quiditch/Quaffle))
o.loc=usr.loc
usr.quaffle=0
walk_to(o,locate(usr.x,usr.y+5,usr.z),5,2)
proc/A()
if(!usr.quiditch)return
for(var/obj/o as obj in usr.contents)
if(istype(o,/obj/Items/Quiditch/Quaffle))
o.loc=usr.loc
usr.quaffle=0
spawn()
walk_to(o,locate(usr.x-5,usr.y,usr.z),,2)
proc/S()
if(!usr.quiditch)return
for(var/obj/o as obj in usr.contents)
if(istype(o,/obj/Items/Quiditch/Quaffle))
o.loc=usr.loc
usr.quaffle=0
walk_to(o,locate(usr.x,usr.y-5,usr.z),,2)
proc/D()
if(!usr.quiditch)return
for(var/obj/o as obj in usr.contents)
if(istype(o,/obj/Items/Quiditch/Quaffle))
o.loc=usr.loc
usr.quaffle=0
walk_to(o,locate(usr.x+5,usr.y,usr.z),5,2)
proc/Space()
if(!usr.quiditch||usr.quaffle)return
for(var/obj/o as obj in oview(1))
if(istype(o,/obj/Items/Quiditch/Quaffle))
o.loc=usr
usr.quaffle=1
return
for(var/mob/m as mob in oview(1))
for(var/obj/o as obj in m.contents)
if(istype(o,/obj/Items/Quiditch/Quaffle))
var/chance=rand(1,round(max(m.overalllev-usr.overalllev,2)/2))
if(chance==1)
var/chance2=rand(1,max(1,round(usr.overalllev/8)))
if(chance2==1)
o.loc=m.loc
m.quaffle=0
else
o.loc=usr
m.quaffle=0
usr.quaffle=1

DMS:
macro
a return "a"
b return "b"
c return "c"
d return "d"
e return "e"
f return "f"
g return "g"
h return "h"
i return "i"
j return "j"
k return "k"
l return "l"
m return "m"
n return "n"
o return "o"
p return "p"
q return "q"
r return "r"
s return "s"
t return "t"
u return "u"
v return "v"
w return "w"
x return "x"
y return "y"
z return "z"
Space return "space"

There we go. Its the returning im worried about so forget the usr abuse for the moment(even though it would work in client).
In response to Magic Enterprise
Worry about the usr abuse. There's no point trying to do anything with it unless you fix one of the more egregious errors there.
In response to Magic Enterprise
Eww, deadron's library. http://developer.byond.com/hub/Crashed/crashMacros

With my lib, you'd first remove all those verbs. They're unneeded. And you can take out the 'input' procedure as well. All you need to do is:

client
Commands("a"="A","w"="W","s"="S","d"="D","space"="Space")

In response to Crashed
But the problem im having is not with the actual procedures its running, im having troubles with actually returning the macro. It always says [No macro has been defined for "a". Please turn on macro-mode] or something like that and it shouldnt say that as I defined it in the dms file.
Bump