ID:156697
 
I'm new to skins, I have never really tried them out before. I just read the skin reference a few minutes ago, and I attempted to change a verb at runtime using winset(), but I am having issues.

mob/verb/A_Key(setcommand)
winset(usr,"macro.A","command = [setcommand]")


The name of the macro file in the skin is 'macro', and I don't have an ID for the key. So, what is the issue here?

Any help is appreciated, and thanks!
I think you cannot use space out there, try:
winset(usr,"macro.A","command=[setcommand]")
In response to Ripiz
I'm still having issues with something as simple as this.

macro -- name of file under Macros in the interface

key1 -- Id of key, the 1 Key to be exact

Test() -- The 'command' used

*When I login, and hit the 1 key, no message is shown*

mob/Login()
winset(usr, "macro.key1","command=Test")

mob/verb/Test()
alert("Test.")
In response to OrangeWeapons
I'm not sure if this is going to help, but I found it in the Skin Reference and I thought maybe it was the formatting of the way winset() is done in your example.

winset(usr, "key1", "parent=macro;name=1;command=Test")


What this does is make a new macro called "key1" in the macro called "macro." The NAME of a key combination is actually the combination itself. In this case, pressing the 1 key will probably give you the name "1". The command used is "Test," which is done appropriately.
In response to Makeii
No, that doesn't seem to work. That's for adding a new macro at runtime. I am attempting to change the command of a macro at runtime.
In response to OrangeWeapons
Bump
In response to OrangeWeapons
Try putting double quotes around the command:

Also, you might as well use src in Login().

<edit>

I just tried it both ways, and it's working fine for me. Are you sure you have the name of the macro set right?

Here's all I did:
mob/verb/Test()
world<<"Worked"

mob/verb/Test2()
world<<"Failed"

mob/Login()
winset(src,"macro.A","command=Test")


In my interface file I had a macro set called "macro" and gave the 'A' key the command "Test2".
In response to DarkCampainger
This is very odd that it isn't working, I am doing exactly this. My skin file name is macro. So then, under the file macro, I set one up with the A key, and check off the repeat box. The message is never sent to me though. Then, I do this on login:

mob/verb/Login()
winset(src,"macro.A","command=Test")

mob/verb/Test()
src << "Hi"


This is a compiled demo:

http://www.qfpost.com/ download.do?get=583a9a4e0406c2cef0b1b94d23f046b1

(Chaorace, that was a spelling error I made while posting. A compiler would warn you of having an empty parenthesis and wouldn't allow you to run the program.)
In response to OrangeWeapons
you forget the ) at the end of the winset line, winset(src,"macro.A","command=Test")
In response to Chaorace
Bump. I'm sure this is a simple procedure, I don't get why it isn't being answered.
In response to OrangeWeapons
OrangeWeapons wrote:
Bump. I'm sure this is a simple procedure, I don't get why it isn't being answered.

Your demo has two problems:

1) You have to connect the window to the macro set you are using. Edit the properties of window1 and under the 'Options' tab you'll see Macro ID. In the pulldown, select 'macro'.

2) winset() is used to modify existing macros, so you can't use that exact notation to add a new macro. As per the skin reference, to add a new macro, use the 'parent' property. In your case, that'd look like:
winset(usr, "A", "parent=macro;name=A;command=Test") // the first argument is the macro id, which  can be anything you want, to refer to later


That said, your notation is more intuitive and maybe we can use that as a shorthand to add macros. The reason for our current notation is to be consistent with the window & menu elements (think of a macro element as its own control within the macro set, similar to an interface element within a window).

HTH
In response to Tom
Alright, I see what you mean now, thanks!
In response to OrangeWeapons
I'm learning this stuff to, so I tried to test, I can't figure it out either. I did what Tom said. What did you do to figure it out orange?
In response to Chaorace
In response to OrangeWeapons
cant download for some reason
In response to Chaorace
Download it in the ZIP format, it tells you on the Hub. It's below the title and looks like this:

<font color = "gold">[Zip]</font>
In response to OrangeWeapons
I know, I tried, but you can't dl it o.o It brings you to the plaec i hit download file and it brings you to, webpage cant be found. 404 error crap
In response to Chaorace
I'm having issues with it. I may become a Byond member soon anyways. In the mean time, here is a link to a copy of it:

http://www.qfpost.com/ download.do?get=d51392503662a70afc715a579aa76340