View Full Version : Crysis style control in 3dsmax
animaxforever 03-09-2008, 07:52 AM hi guys,
everyone must have played crysis game... so i was thinking if it is possible to implement the style of control as shortcut keys in max....as pressing key "L" two times will select edge loop and so on....i just starteds learning max script, though i've no clue how to go about it...
|
|
marktsang
03-09-2008, 10:58 AM
i havent play crysis, but i cant see how pressing L twice for anything would be more efficient than pressing it once? why would you want this?
scrimski
03-09-2008, 11:17 AM
It's usefull for toggling through different modes with one hotkey.
animaxforever, search scriptspot for CleverRotate, it's a script written by Jim Jagger, not eexactly what yo are looking for, but with the functions you need, just rewrite it a bit.
Dimich
03-09-2008, 09:09 PM
Yea, but this guy's script uses case of condition which simply checks which is selected, not the amount of times the button is pressed. I beleive MaxScript doesn't support double tap for buttons.
Pjanssen
03-09-2008, 09:47 PM
You could run a timer which resets the count :)
U.S.S. Speed
03-10-2008, 02:46 AM
Wouldn't it run a second instance of the script with a second instance of the variable?
Pjanssen
03-10-2008, 05:27 AM
Not if you use a global variable.
Dimich
03-10-2008, 09:19 AM
Well, to be honest, I haven't even found a way to script the shortcut keys in 3DsMax. The only way you can assign a key on a keyboard to do a function if through a Macro, and I do not recall MaxScript having any sort of callback for the pressing of buttons on keyboard. You can deffinately cycle through options/variables/values/etc., but to detect double taps, as far as I know, is impossible. But hey, Bobo, if you see this, please let us know, because it would be a great advantage to access keyboard properties.
Pjanssen
03-10-2008, 10:18 AM
Yeah you'd indeed have to assign a macroscript to a key.
Double-tapping a key shouldn't be too hard to make. The first time the script runs, add one to a counter, and evaluate the counter value. If it is 2, run your function.
Also, each time the script is run, (re)start a timer with an interval of say 500ms. The timer calls a function which resets the counter.
Result: if you press a key twice within 500ms, a function is started.
Pjanssen
03-10-2008, 10:44 AM
A quick draft/proof of concept:
macroscript doubleKeyPress
category:"test"
(
isOpen = false;
doubleKeyPressCounter = 0;
rollout timerRoll "timerRoll" (
timer doubleKeyPressTimer interval:400 active:false;
on doubleKeyPressTimer tick do (
doubleKeyPressCounter = 0;
destroyDialog timerRoll;
)
on timerRoll open do (
isOpen = true;
doubleKeyPressTimer.active = true;
)
on timerRoll close do (
isOpen = false;
)
)
function evalCounter = (
if(doubleKeyPressCounter == 2) do (
doubleKeyPressCounter = 0;
destroyDialog timerRoll;
print "Start Something!";
)
)
function resetCounter = (
doubleKeyPressCounter = 0;
)
on execute do (
if not isOpen do createDialog timerRoll pos:[-10000,-10000]
doubleKeyPressCounter += 1;
evalCounter();
)
)
For some reason there's no exposed timer class in maxscript outside dialogs? But this works too.
You can get a timer using dot net so you don't have to have a rollout open.
animaxforever
03-10-2008, 03:04 PM
Thanx all of you for the replies....
nice work Pjanssen......i don't know what's the problem now...i just have to put the edge loop or what ever function i want into the script and that's all...isn't it?
Pjanssen
03-10-2008, 03:15 PM
You can get a timer using dot net so you don't have to have a rollout open.
Ah yes of course :)
nice work Pjanssen......i don't know what's the problem now...i just have to put the edge loop or what ever function i want into the script and that's all...isn't it?
Yeah, but that will not be extremely useful yet, as it will only do something when the button is pressed twice. I think that you've got basically two choices for it's behavior:
Either have a function that is always executed with the first keypress, and have an additional function executed at the second (if within the time limit).
Or evaluate the amount of keypresses after the timer ticked and decide which function to execute.
CGTalk Moderation
03-10-2008, 03:15 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.