Another left field idea related to scripting ....

Discuss ideas for new features with other users. To submit feature requests to Smith Micro, please visit support.smithmicro.com

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
bupaje
Posts: 1175
Joined: Fri Nov 12, 2004 5:44 pm
Location: California
Contact:

Another left field idea related to scripting ....

Post by bupaje »

Hope I don't alienate anyone with all these wacky ideas but gotta let 'em out.

I was working on another problem and came across an old copy of Jasc Media Center and the built in 'tags' called MCML that you could use to do some simple actions. They were somewhat similar to the tags that the Atomz search engine use to have that allowed you to do some simple 'programming' if anyone else ever used them.

I was wondering if something similar might work with Moho / Lua. Since I don't always explain myself with clarity, what I am talking about is some tags that would represent a block of Lua code thus hiding some of the complexity from the non programmers; this would then be processed into normal Lua code. For example the tags I mentioned might be like this

Code: Select all

<moho-loop>
  <moho-read-directory (_moho-local/images, $$dirname)>
    <moho-find-file-type (jpg, $$filename)>
    <moho-if-none-end-loop>
  <moho-import-as-layer, $$filename>
</loop>
Not sure if this is practical, but if some simple Lua operations or functions could be 'packaged' and represented by markup style tags, then these tags replaced by some sort of operation "Convert Moho Markup to Lua?" to produce a .lua file, maybe more people could contribute. As a library of tags was built over time you might get more and more useful code as well as relieving some of the burden by allowing non-programmers to generate some simple scripts themselves.

Just a wild thought ...
anigreator
Posts: 36
Joined: Tue Mar 22, 2005 11:47 am

Post by anigreator »

It is a wacky one, but as far as I understand things at the moment, Lua would support this king of script-on-top-of-script setup, providing someone put in all of the work to invent a new and robust markup language.

Lua supports execution of strings as code. Hence, you could interate through the markup replacing the tags with their Lua equivalent logic, then send the parsed text off for execution.

Or, you could just learn Lua, which I suspect might be less time consuming in the long run. ;)

Something that might be a very helpful intermediate of the two would be for all the scripters to start posting simple code examples, maybe in a new scripting forum. For example: 'How to create a simple dialog', 'How to load an image as a layer' etc etc.

Just my tuppence!

Cheers,

Chris
User avatar
bupaje
Posts: 1175
Joined: Fri Nov 12, 2004 5:44 pm
Location: California
Contact:

Post by bupaje »

Learning Lua would definetly be the idea thing for me. :)

I do think as the Moho community grows and more and more 'average' users join having a tag system or even a way to record and playback macro like scripts would be useful. I lurk around a few other communities like 3D Game Studio, ZBrush and Paint Shop Pro that have been around longer and invariably there is a clamoring for a little script to do this or a script to do that; as more and more less programming savvy new comers arrive the volume of this gets higher. A simple tag system or even a macro recorder of some sort would allow a second tier of users - likely much more numerous than the amount in the programmer group - to contribute.

I second the idea of creating smaller code blocks to analyze. I use to own a VB programming site for beginners and those were some of the most popular pieces, bits of simple 'drop in' code. By boiling them down to a single operation or two the workings become more obvious.
anigreator
Posts: 36
Joined: Tue Mar 22, 2005 11:47 am

Post by anigreator »

In that case it would be pretty easy to write a macro system that just expands the tags out to Lua codeblocks.

First though, we need the Lua code, which I suspect might take some time since none of us are pro sciptwriters, just fitting it in between other stuff.

Any ideas as to what would be the most useful tags?
User avatar
7feet
Posts: 840
Joined: Wed Aug 04, 2004 5:45 am
Location: L.I., New Yawk.
Contact:

Post by 7feet »

Well, since overall the syntax of Lua is pretty straightforward, it would seem to be easier to create a library of global functions for most things. Your generic open/import/save/search for files, some basic manipulation, really anything that might give a nonprogrammer a headache could be made up as a really no-nonsense global function.Like:

Code: Select all

inputFileName(filename)
validJPEG = findImage(PICTURE_PATH,JPEG,filename) 
if validJPEG then importFile(PICTURE_PATH,JPEG,filename,currentFrame) end
Except for the looping markup, anything you are talking about in your bit could be done right in Lua. It's my thought that it is really unnecessary to set up a macro interpreter when you can just run lua code dynamically anyway. Just me, though. One thing I wouldn't mind at all, and might do, would be to build some sort of GUI for makeing up dialogs. That probably wouldn't be too hairy, but I haven't tried it yet. One thing that would help a lot is if LM could throw in an "LM.GUI.openDirectory" command to just choose paths.

Also, bupaje, you've said in the past that you had a bit of bandwidth to spare. Dunno if you did it yet, but I made one of those searchable e-book versions of the scripting reference (which helps a lot), I was wondering if I sent it to you if you could put it up. It's really handy.
User avatar
bupaje
Posts: 1175
Joined: Fri Nov 12, 2004 5:44 pm
Location: California
Contact:

Post by bupaje »

7feet wrote:Well, since overall the syntax of Lua is pretty straightforward, it would seem to be easier to create a library of global functions for most things. [...] Except for the looping markup, anything you are talking about in your bit could be done right in Lua. It's my thought that it is really unnecessary to set up a macro interpreter when you can just run lua code dynamically anyway. Just me, though. One thing I wouldn't mind at all, and might do, would be to build some sort of GUI for makeing up dialogs.
That would work I think. Truth is I want to get my feet wet with the programming but a bit too much info for me to digest as is. Bundling some of the stuff into black box functions -where I don't have to understand all the inner workings but still can get something done would be workable for me.
Also, bupaje, you've said in the past that you had a bit of bandwidth to spare. Dunno if you did it yet, but I made one of those searchable e-book versions of the scripting reference (which helps a lot), I was wondering if I sent it to you if you could put it up. It's really handy.
Yes, be glad to post it. I haven't got the site ready yet but certainly can at least host it for now. Later I'll be glad to maybe host code snippets or other useful bits. Either email it to me or tell me how you want to do this.
User avatar
7feet
Posts: 840
Joined: Wed Aug 04, 2004 5:45 am
Location: L.I., New Yawk.
Contact:

Post by 7feet »

Black-box fuctions... Yeah, like that. Work with the KISS. For the people who want to delve in, maybe a thread (or dedicated forum) to this.
I'm all for it. Quick and easy... That's the trick.
Post Reply