/trunk
BINDING_HEADER_XCALC = "xcalc (automatic)"; |
XCALC_VERSION = "2.06"; |
BINDING_HEADER_XCALC = "xcalc (automatic)"; |
BINDING_NAME_XC_NUMLOCK = "Numlock"; |
BINDING_NAME_XC_CLEAR = "Clear"; |
BINDING_NAME_XC_CLOSE = "Close"; |
BINDING_NAME_XC_8 = "Digit 8"; |
BINDING_NAME_XC_9 = "Digit 9"; |
BINDING_NAME_XC_DEC = "Decimal"; |
BINDING_NAME_XC_BACKSPACE = "Backspace"; |
XCALC_REMAPPED = { |
NUMLOCK = ""; |
HOME = ""; |
END = ""; |
NUMPADDIVIDE = ""; |
NUMPADMULTIPLY = ""; |
NUMPADMINUS = ""; |
NUMPADPLUS = ""; |
ENTER = ""; |
NUMPAD0 = ""; |
NUMPAD1 = ""; |
NUMPAD2 = ""; |
NUMPAD3 = ""; |
NUMPAD4 = ""; |
NUMPAD5 = ""; |
NUMPAD6 = ""; |
NUMPAD7 = ""; |
NUMPAD8 = ""; |
NUMPAD9 = ""; |
NUMPADDECIMAL = ""; |
}; |
XCALC_NUMBERDISPLAY = "0"; |
XCALC_RUNNINGTOTAL = ""; |
XCALC_PREVIOUSKEYTYPE = "none"; |
SLASH_XCALC3 = "/="; |
xcalc_optionvariables(); |
xcalc_minimap_init(); |
XCALC_VERSION = GetAddOnMetadata("xcalc", "Version"); |
end |
--Fuction for setting up Saved Variables |
function xcalc_optionvariables() |
if (Xcalc_Settings.Binding == nil) then |
Xcalc_Settings.Binding = 1; |
Xcalc_Settings.Binding = 0; |
end |
if (Xcalc_Settings.Minimapdisplay == nil) then |
Xcalc_Settings.Minimapdisplay = 1; |
--Processes for binding and unbinding numberpad keys to Xcalc |
function xcalc_rebind() |
if (Xcalc_Settings.Binding == 1) then |
for x = 1, GetNumBindings() do |
currBinding = GetBinding(x); |
keyone, keytwo = GetBindingKey(currBinding); |
for key,value in pairs(XCALC_REMAPPED) do |
if (keyone == key or keytwo == key) then |
XCALC_REMAPPED[key] = currBinding; |
end |
end |
end |
--steal numlock away from anything else |
SetBinding("NUMLOCK", "XC_NUMLOCK"); |
SetBinding("HOME", "XC_CLEAR"); |
SetBinding("END", "XC_CLOSE"); |
SetBinding("BACKSPACE", "XC_BACKSPACE"); |
--set numlock on keys |
SetBinding("NUMPADDIVIDE", "XC_DIV"); |
SetBinding("NUMPAD9", "XC_9"); |
SetBinding("NUMPADDECIMAL", "XC_DEC"); |
SaveBindings(2); |
end |
end |
function xcalc_unbind() |
if (Xcalc_Settings.Binding == 1) then |
LoadBindings(0); |
for key,value in pairs(XCALC_REMAPPED) do |
SetBinding(key, value); |
XCALC_REMAPPED[key] = ""; |
end |
SaveBindings(2); |
end |
end |
xcalc Result: (3.5g + 50s) * 2 = 8g |
/calc 4g / 5 |
xcalc Result: 4g / 5 = 80s |
<Binding name="XC_CLOSE" description="Close"> |
xcalc_display(); |
</Binding> |
<Binding name="XC_BACKSPACE" description="Backspace"> |
xcalc_backspace() |
</Binding> |
<Binding name="XC_DIV" description="Divide"> |
xcalc_funckey("/"); |
## Interface: 30000 |
## Interface: 20400 |
## Title: xcalc |
## Author: Moird |
## Version: 2.1.wowi:revision |
## Version: 2.06 |
## Notes: Basic Calculator |
## eMail: peirthies@gmail.com |
## DefaultState: Enabled |