Maxscript editor tip/tutorial


#1

Hi everyone,

I made a small video tutorial about a thing I found very usefull in the maxscript editor, I haven’t read anyone writing about it, but maybe I haven’t looked enough, but here it is: http://public.subd.nl/screencasts/

Hopefully it’s of any use.

-Johan


#2

Hey Johan,

didn’t know that < : thanks for that!

J.


#3

That is one awesome time-saver. Thanks for sharing.


#4

That is fantastic, thanks for putting that up there.


#5

Just as a note, it is case sensitive.


#6

That’s a good way to keep scripts written in a consistent way!
Thanks!


#7

Thanks guys, it really shows how accustomed everyone was to the terrible, horrible old mxs editor, and we’re probably so happy with a pretty decent editor (although I can come up with a feature or 2 one, like code completion) not a lot of people delved into the new options… at least not me… until now that is… there are a lot more little gems hidden in the prefs file, like being able to open more then 10 files, multilinetabs etc… and I really wished the output pane could be used as a listener, so we could ditch the clumsy listener and have a streamlined window for editing and output.

-Johan


#8

a killer tip, man =)


#9

speaking of improvements to the mxsEditor - with the klunky old one, i did enjoy opening scripts in multiple windows to compare them side-by-side. i can’t really do this easily with the tabbed interface. i’d like the option to “float” one of the tabs or open multiple editors. if anyone knows how to do this & i’m just missing it, i’d appreciate the tip!


#10

A little tip to help with making it easier to format the abbreviations file.

Write the code as you normally would in a script, then using the replace tool (Ctrl+H) turn on the “Transform backslash expressions” checkbox (Alt+B) and perform find and replace on line breaks and tabs.

if EXPR then
  (
  	EXPR
  )
  else
  (
  	EXPR
  )

If you use that chunk of code and then do a search and replace searching for "
" and replacing with "
" (no quotations), it will insert a "
" at the beginning of each new line.

Then do a search and replace using " " and "\ " and it will replace all of the tab characters.

All thats left to do is a few button presses using the “End” and “Delete” keys and your abbreviation file is nicely formatted.

EDIT: I just did the search and replace with "
" and "
" and this time it actually replaced the line breaks. Not too sure why it is leaving them in sometimes and sometimes not.


#11

and I really wished the output pane could be used as a listener, so we could ditch the clumsy listener and have a streamlined window for editing and output.

totally agree :wink:

Thank for the tip , very useful !!


#12

Maybe we should put up our abbreviations for other to have a look see.
Here are mine so far


 /* COMMENTS */
 menu=--@categorie:CAT;name:NAME;description:DESC
 header=
--******************************************************************************************************
-- Created: 		00-00-2009
-- Last Updated:	00-00-2009
-- Version:			0.10
--
-- Author :  Johan Boekhoven / johan.boekhoven@gmail.com / subd.nl
-- Version:  3ds max 2009 (10) (should work in older versions too!)
--
-- Discription: DESCRIPTION
-- Usage: RUN IT
--
-- Wishlist:
--
--******************************************************************************************************
-- MODIFY THIS AT YOUR OWN RISK

 doc=/*
<DOC> Description here.
Arguments:
	<bool> arg_a:		A description of the argument.
Return:
	<bool>		Function returns (anything?).
*/
 
 /* CODE STRUCTURES */
 if=if ARG then
(
	STATE1
) -- end if
else
(
	STATE2
) -- end else
 fn=fn NAME arg_a arg_b =
(
	doc
	fnBody
)
 str=struct NAME
(
	VAR1,
	VAR2,
	fn
)
 fora=for  in  do
(
	
)

 foraw=for  in  where ARG1 == ARG2 do
(
	
)

 fori=for i = 0 to 100 do
(
	
)

 foriw=for i = 0 to 100 where ARG1 == ARG2 do
(
	
)

 foribw=for i = 0 to 100 by  where ARG1 == ARG2 do
(
	
)

 rol=rollout ""
(
	btn
	spn
)


/* GENERIC */
 start=menu header
(
	
)
 
 /*CONTROLS*/
 btn=button btn_ "" width: height: offset:[0,0] across:
 pbn=pickButton pbn_ "" width: height: offset:[0,0] across:
 spn=spinner spn_ "" width: range:[,,] type: offset:[0,0] across:
 chb=checkButton chb_ "" width: height: offset:[0,0] across:
 grp=group ""
(
	btn
	spn
	chb
	pbn
)
 

Some are obviously specific for my needs, but maybe somebody can use it.
I think especially in the commenting and UI building and CA building department lot of speed can be gained by some well balanced abbreviations.

Has any also checked out the great work Rob is doing over at TAO and I try to follow the http://tech-artists.org/wiki/TAO:Code_Conventions, I think some public accepted abbreviations could help on good coding practice, but that’s me.

@Mathieson, that’s a really good tip!!

Cheers,
-Johan


#13

do you know if it’s possible to remap the shortcut , I don’t find it very straight forward ??


#14

you must edit the MXS_Editor.properties file.
To do this choose the option ‘open global option file’ from the tool menu.
Search the line ‘# User defined key commands’
and then add a line with your shortcut and the command you need.

you can find the explanation in the '[color=white]MAXScript Editor - Defining Custom Keyboard Shortcuts’[/color] tread, from the maxscript help

sorry for my english

cheers


#15

Thank ! this work very well :applause:
the line to add is : Ctrl+?|IDM_ABBREV|


#16

some dotnet one that I often use :rolleyes:


 /* .NET */
  
 dcol=(dotnetclass "system.drawing.color").fromargb 0 0 0
 dstr=(dotnetobject "system.string" "")
 darr=(dotnetclass "system.array")
 darrr=(dotnetobject "system.array[]" 1)
 dpt=dotnetobject "system.drawing.point" 0 0
 dsize=dotnetobject "system.drawing.size" 0 0
 dpad=dotnetobject "system.windows.forms.padding" 0 0 0 0
 dpen=(dotnetobject "system.drawing.pen" (dotnetobject "system.drawing.solidbrush"((dotnetclass "system.drawing.color").fromargb 0 0 0)) 1)
 dbrush=(dotnetobject "system.drawing.solidbrush" ((dotnetclass "system.drawing.color").fromargb 0 0 0))
 stcp=(dotnetobject "system.windows.forms.columnstyle" (dotnetclass "system.windows.forms.sizetype").percent 50)
 stca=(dotnetobject "system.windows.forms.columnstyle" (dotnetclass "system.windows.forms.sizetype").absolute 20)
 strp=(dotnetobject "system.windows.forms.rowstyle" (dotnetclass "system.windows.forms.sizetype").percent 50)
 stra=(dotnetobject "system.windows.forms.rowstyle" (dotnetclass "system.windows.forms.sizetype").absolute 20)

 

#17

This thread is so usefull :wink: Thx to all involved
Should be stickied !!!


#18

Ha Johan you’ve really hit upon a common note < :

FWIW I qwish we could open multiple script windows as well but i don’t think it is possible.

J.


#19

wooow!this thread very useful for me!thanks a lot! :bowdown:


#20

:wavey: :bowdown: