Teething troubles

Geoff Canyon gcanyon at inspiredlogic.com
Thu Feb 14 17:42:01 EST 2002


At 9:27 PM +0000 2/14/02, Marcus Bointon wrote:
>I'm new to Revolution, but have plenty of experience in Director and RB, and
>I'm having a few problems with Revolution, so here's a whole bunch of
>questions.

Welcome!

>I'm developing an app that has no visual interface at all - it reads the
>contents of a file and decides whether to launch some other apps on the
>basis of what it finds. So far I have built this in about 30 lines of code
>as a stack script all triggered from an openstack message. I have set the
>(unused) window to be invisible. Revolution crashed with a type 2 when I
>also turned off the "buffer display" window property - I figured there was
>no point in having a buffer for a window with no contents that would never
>be seen.

You can have Revolution execute a pure script; I believe you just have to handle the on startUp message.

>While trying a test with this stack, I accidentally selected "suspend
>revolution UI". Everything effectively became unusable, and the restore
>interface button did nothing. If I put the mouse near the menu bar, it acted
>like I was pressing the button up & down about once per second. Very odd. I
>had to force-quit to get out of it.

In situations like this, try launching the (apple)Script Editor and execute this:

tell application "Revolution 1.1" to quit

>Is there any equivalent of classes like in RB and Director? I'm used to just
>being able to say new(script "whatever") to instantiate new objects on the
>fly, especially non-visual abstract things. These don't have a place in the
>stack/card/button/object metaphor that I have found.

You can certainly do this, but generally the need to creat a new "something" is for visual objects, not for abstract code. At that level, Revolution is not object-oriented. You don't need a new object to store some new data, you just need a new variable (or array).

>While trying to debug things, particularly using the message window to send
>messages I find that often the errors generated don't reflect the problem,
>for example I find that "handler not defined" usually means there is an
>error in the handler in question that prevents it from compiling, rather
>than it not existing, but I can't find any way of it getting me any more
>detail than that. When I do manage to get a proper error dialogue appearing,
>more often than not it's an error in the Revolution IDE, rather than
>anything I've written which was initially very confusing as I couldn't
>figure out where all this code was coming from! I feel like I'm missing
>something like the "recompile now" button in Lingo.

It may not be the most helpful error message, but the "handler not defined" error is technical true: if the handler won't compile, there is no handler. Generally scripts are checked for syntax errors whenever you save them. There is at least one way to circumvent this, which the Revolution crew are aware of. If you get this error, you can probably nail it quickly by copying the handler in question to another object's script (a new button will do). The syntax checker will trigger, tell you what the error is, and you can copy the handler back.

>I sometimes find the debugger is out of sync with my code, even if I close
>it, force an apply, and reopen the debugger, it may still show an old
>version. This seems intermittent.
>
>Arrays (which are like lingo property lists to me) seem to act oddly in
>places. For example, it's easy to display some info using "put the keys of
>someArray", but if I say "put someArray" I get a vast amount of garbage
>characters in the message window rather than anything meaningful (in fact
>this crashed Revolution on one occasion).

Saying "put someArray" doesn't automatically convert the array to text. You can put a value from an array, but not the array itself.

>The split command seems to expect data in value/name pairs rather than
>name/value, e.g. If I want to set some values thus:
>
>name=widget
>size=20
>colour=yellow
>
>I can't split this using return and "=" as it will come out the wrong way
>around, as in widget=name etc. Something more powerful like the Perl split
>command would be great.

Can you post a script example? It seems to be working for me.

>What's the standard or usual way of handling XML in revolution?

Manually. For now it's a bit difficult because the regular expression syntax is greedy. This is going to change, though.

>DefaultFolder seems not terribly clever. By default it points to the
>revolution app. It would be more useful if it pointed to the current stack.
>Director has separate names for these places (applicationPath and
>moviePath). It would also be very convenient if it appeared with a trailing
>separator - but make it consistent across platforms, unlike Director! I
>can't find a way of getting the current stack's path.

It points at the current engine. When you build a standalone, that means it points to your application. I always treat Revolution as my application during development so I don't have to do anything special. Others start with the long name of the stack to get the path to the stack. Someone will post a canned script, I'm sure.

And the separator is "/" on all platforms, so your wish is granted :-)

regards,

Geoff




More information about the use-livecode mailing list