Notifications
Clear all

[Closed] Crysis style control in 3dsmax

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…

12 Replies

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?

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.

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.

You could run a timer which resets the count

Wouldn’t it run a second instance of the script with a second instance of the variable?

Not if you use a global variable.

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.

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.

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.

Page 1 / 2