Thread: MAKI Cheats
View Single Post
Old 30th October 2015, 23:06   #897
Plague
f(caffeine){
return wasabi;
}
(Forum King)
 
Plague's Avatar
 
Join Date: Jul 2001
Location: Sweden
Posts: 3,984
It was ages since I last played with maki, but basically if you want to specifically use a tooglebutton (so that it stays pressed when the layer is in one state, and then stays unpressed when the layer is in another state), then I'd suggest using cfgattribs for that.

For example, in dhd-playermode.xml, you find this line, that will toggle the iris on the gate:
code:

<togglebutton id="Iris" x="244" y="133" image="dhd.Iris" downImage="dhd.Iris-on" activeImage="dhd.Iris-on" tooltip="Toggle Iris" cfgattrib="{258968BA-8E47-453c-A008-4433A6EB298E};Iris"/>



The cfgattrib is the interesting part, the GUID you see there {258968BA-8E47-453c-A008-4433A6EB298E} is for a hidden config page in Winamp.
After the GUID, you specify the variable you want to use (Iris).

Then, in attribs.m and gate-playermode.m, you will find the needed script code to handle it.

Basically, you need to add the attrib in maki and use it to toggle the layer you want to show/hide.
For example:
code:

#include <lib/std.mi>
#include <lib/config.mi>
#define HIDDEN_PAGE "{258968BA-8E47-453c-A008-4433A6EB298E}"
Global ConfigAttribute myattr_toggleIris;
Global Layer iris;
System.onScriptLoaded() {
ConfigItem hidden_page = Config.newItem(getSkinName() + " Hidden", HIDDEN_PAGE);
myattr_toggleIris = hidden_page.newAttribute("Iris", "0");
Group sgroup = getScriptGroup();
iris = sgroup.findObject("iris");
myattr_toggleIris.onDataChanged();
}
myattr_toggleIris.onDataChanged() {
if (getData() == "1")
iris.show();
else
iris.hide();
}



The reason for using cfgattribs is that the layer and buttonstate will always be synced.
Plague is offline   Reply With Quote