Forums » Community Projects
I wrote this calculator tonight in lua, basic 4 function, %, -/+, memory.
syntax is /calc
http://wetlands.simplyaquatics.com/d/26827-1/calc-1_1.zip
syntax is /calc
http://wetlands.simplyaquatics.com/d/26827-1/calc-1_1.zip
wow quite possibley the most usefull plugin, perhaps the devs shoudl consider this as part of the next update.
You should make a scientific mode. and have hex support. so you can hex someone.
that's up next :)
I have been looking at a way to do a on/off bind with this and not able to figure that one out. say you bind "F6" to /calc, press once it shows, press again it hides.
Ed
I have been looking at a way to do a on/off bind with this and not able to figure that one out. say you bind "F6" to /calc, press once it shows, press again it hides.
Ed
nice!
I'm pretty sure firsm did something like that in vokb.
Grep for keycmd. looks like he used the k_any attribute on the dialog. That probably only works if the dialog still has focus though.
Another feature request: a command mode, something like this
/calc 1 + 1
2
You could probably abuse loadstring for this if you don't want to write your own evaluator.
loadstring("return "..table.concat(args)) or something like that.
Although it'd allow calling any game function and so kill the client and stuff with a formula...
I'm pretty sure firsm did something like that in vokb.
Grep for keycmd. looks like he used the k_any attribute on the dialog. That probably only works if the dialog still has focus though.
Another feature request: a command mode, something like this
/calc 1 + 1
2
You could probably abuse loadstring for this if you don't want to write your own evaluator.
loadstring("return "..table.concat(args)) or something like that.
Although it'd allow calling any game function and so kill the client and stuff with a formula...
thats just kickass :)
now make it have a nice Ui that goes with the skin your using like notepad
now make it have a nice Ui that goes with the skin your using like notepad
Yeah I've been using loadstring for my own calculator recently.
You'd have to look at some bind/alias examples that toggle.
Basically, it consists of 3 alias/binds that bind the key back and forth between two commands
/alias blahon calcon; bind key blahoff
/alias blahoff calcoff; bind key blahon
/bind key blahon
I think that may work. I haven't used alias/binds in a long while.
You could do a bunch of it in lua, instead.
make your /calc function see if calc dialog is open and then close it and vice versa checking whether dialog.visible=="YES" or not.
Basically, it consists of 3 alias/binds that bind the key back and forth between two commands
/alias blahon calcon; bind key blahoff
/alias blahoff calcoff; bind key blahon
/bind key blahon
I think that may work. I haven't used alias/binds in a long while.
You could do a bunch of it in lua, instead.
make your /calc function see if calc dialog is open and then close it and vice versa checking whether dialog.visible=="YES" or not.
The problem is when the lua apps are displayed all of the keyboard shortcuts are disabled because the lua app has control. I figured there were 2 possible ways to handle this. 1) read the binds and check for the app toggle, 2) some how give partial control to the app which would be a very bad idea as the app may need some/many/all of the hot keys for other things.
I am also not aware of any way to read the binds inside lua.
Ed
I am also not aware of any way to read the binds inside lua.
Ed
Oh yeah, duh.
You can do this:
function dialog:k_any(char)
local command = gkinterface.GetCommandForKeyboardBind(char)
if command == 'calc' then
-- close window here
return iup.IGNORE
end
return iup.CONTINUE
end
That will make your dialog close when it sees the key bound to the calc command being pressed.
You can do this:
function dialog:k_any(char)
local command = gkinterface.GetCommandForKeyboardBind(char)
if command == 'calc' then
-- close window here
return iup.IGNORE
end
return iup.CONTINUE
end
That will make your dialog close when it sees the key bound to the calc command being pressed.
oh yes, that works superb thanks!
We need a kb for stuff like this.
Ed
We need a kb for stuff like this.
Ed
This is version 1.1 I have added several things.
USAGE: /calc
Changed:
Keyboard input,
Sci functions,
function color codes,
extra error checking,
Hot keys:
# = number 0-9
* = multiply
+ = plus/equal
enter = equal
. = period
/ = divide
% = percent
- = minus
= - equal
Backspace = delete last digit on display
a = clear all
e = clear entry
m = memory add
r = memory recall
c = memory clear
ESC = closes program
'bind key' = closes program
http://wetlands.simplyaquatics.com/d/26827-1/calc-1_1.zip
enjoy
Ed
USAGE: /calc
Changed:
Keyboard input,
Sci functions,
function color codes,
extra error checking,
Hot keys:
# = number 0-9
* = multiply
+ = plus/equal
enter = equal
. = period
/ = divide
% = percent
- = minus
= - equal
Backspace = delete last digit on display
a = clear all
e = clear entry
m = memory add
r = memory recall
c = memory clear
ESC = closes program
'bind key' = closes program
http://wetlands.simplyaquatics.com/d/26827-1/calc-1_1.zip
enjoy
Ed
Now make a graphing one! :D
Who's gonna make a Massively Multiplayer Online Roleplaying Game in Lua that we can load into vendetta?
If Divide by Zero errors don't cause your ship to explode, then I think it's just not worth it.
On Tuesday at 11:13 PM, greengeek wrote:
If Divide by Zero errors don't cause your ship to explode, then I think it's just not worth it.
+1
If Divide by Zero errors don't cause your ship to explode, then I think it's just not worth it.
+1
+2
+3
A Traders dream app. Thanks. :)
"On Tuesday at 11:13 PM, greengeek wrote:
If Divide by Zero errors don't cause your ship to explode, then I think it's just not worth it.
" QFT
If Divide by Zero errors don't cause your ship to explode, then I think it's just not worth it.
" QFT