Notifications
Clear all

[Closed] when write a big script…

Little question for DenisT in his nested struct example.
I don’t understand this line

local _sk = if _sk != undefined do _sk

After rollout definition you set rol._sk as a shortcut to your global struct, right?
So, _sk is never undefined…
I don’t get it :surprised

 PEN

Great thread.

Glad to know Denis that I basicly follow the same rules as you. I don’t like fileIn or Include, avoid Globals as much as possible and use structs to contain every thing.

The one thing that I played with years ago and then just stopped doing was nested structs, don’t know why but just stoped using them. I think I will start making that a habit again.

Gravey, I like the idea of the script compiler, never thought of doing that.

I’m working on a 7000+ line tool at the moment, and I manage it by keeping everything in sections, declare lots of functions and putting ( ) around code sections so I can use the folds to make scrolling down a 7000line bit of code a lot quicker to find bits in. Just annoying maxscript can’t record your folds so next time you open the script it’s folded how you left it.

How does everyone write their code, in the inbuilt maxscript editor? Or in a different tool?

4 Replies
(@ian31r)
Joined: 10 months ago

Posts: 0

I like to use a similar program to Notepad++, called PSPad. You can use several different syntax highlighters with it,and you can make your own, so I use a decent Maxscript highlighter I found, to make my scripts. Its not perfect, and I often have to add keywords to it, but it gets the job done. However a lot of times, when I’m testing out my scripts, I’ll end up tweaking them in the editor.

Screen –
/

(@davewortley)
Joined: 10 months ago

Posts: 0

I’ve seen a few people using this approach but I’ve often wondered how you deal with bug checking? Is there some form of plugin so that max can highlight your problem line in your PSPad?

(@ian31r)
Joined: 10 months ago

Posts: 0

Well, usually I use PSPad for the bulk of the scripting, and use the editor to test and refine the scripts. I try to test all of my functions / scripts anyways, because even if your script is bug free, the script might not be doing exactly what you want. You could probably make a plugin to do bug checking, but I’d rather save the time making more scripts I mainly use PSPad because of the syntax highlighting and because it has a lot of tools, such as mass replacing, sorting, general line manipulation, and bookmarking inside of your documents.

The dark Notepad++ style is pretty nice as well. I use a custom windows 7 theme, which makes the rest of the application dark too. – http://googleex.com/desktop/889-windows-7-theme-concave-7-theme.html I customized my color theme for it in max – / So yes, I definitely like to use the dark maxscript editor. I like dark themes for text editors in general, since its better for your eyes spending hours in front of a screen every day. And of course, I love the new dark Photoshop CS6 theme, I just wish you could have colored icons.

If anyone is interested in the color theme for PSPad, let me know.

(@gazybara)
Joined: 10 months ago

Posts: 0

I love to see nice colored text editor.
For Notepad++ i use add-on by Ofer Zelichover (www.oferz.com).
I modify the color to look like this Notpad++ color style
Npp_Maxscript_v1.1.rar
And for the MaxScript Editor I assume you already know for this solution by spacefrog
http://www.scriptspot.com/3ds-max/scripts/darkscintilla-maxscript-editor-dark-scheme

 j83
  Here are a few of my opinions and experiences when working with scripts that used global data,

[ul]
[li]issues are worse when the global variable names are terse, and common variable names at that, such as “up” or “valid”, etc. or other such common words.[/li][li]at least the script writer should have a callback for when the script closes to mark all globals as undefined,[/li][li]can hide logic bugs and other type of bugs that are harder to catch, as the global data can hide the poor layout of the flow of the script[/li][li]I think the main point it, just because someone uses a script or tool you wrote, doesn’t mean you should take the liberty of dumping global variables and data all over their scene. :)[/li][/ul]There are more, but those are a few of the things I’ve experienced when dealing with global data.

In a studio environment, perhaps where you’ll be working with a lot of other scripts, a common global namespace would be valid, but my main annoyance is when users are using a lot of arbitrary scripts from all over the place, which can cause a lot of unusual bugs.

I’m getting a bit curious about the kind of tools you guys write. 20+ KLOC? That’s rather big for a maxscript tool…

Also, I don’t really see the issue with using fileIn. For example with the Outliner I use one “init” script file which does a bunch of fileIn’s, not a problem I’d think.
https://github.com/Pjanssen/Outliner/blob/master/maxscript/script/init.ms

i do absolutely the same. i have a launcher that sets all my stuff before run the main script. i just don’t recommend to use filein and include inside the main script (the real code part)…
but include i don’t use at all.

1 Reply
(@pjanssen)
Joined: 10 months ago

Posts: 0

Aha then I misunderstood your previous post
I never use include myself either.

 PEN

I have tried to use Include thinking that there should be a way to use it and have just never found one. Good to know that others have found the same thing.

Any one using it in a creative way that I have not thought of?

[i]

regarding the global structs in the stdscripts folder – the only problem i have with this is distribution to users – how can i be sure they always have the latest version of any given struct ??

[/i]I’ve just started shifting some common code into a stdplugs/stdscripts/ interface style struct. To make sure the latest version is always used I added a “self” installer to the interface which is called on the interface instance immediately after it’s created. The user would then need restart max to utilize any changed scripts. No Idea if this is the best way to approach it or not. Another way I’m toying with is adding the self install to a #preSystemShutdown callback.

Maxscript Editor is use SciTE. So can realize a project window management dock left in it ? that will be prety cool! :bounce:

Page 2 / 2