Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently October 5th, 2024, 12:27 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: OpusScript-arrays and loops
PostPosted: November 9th, 2005, 10:20 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi

I've worked and worked on this sample script for a project, but can't get it to work properly.

If anyone with scripting skills, capable at deciphering scripting errors, would like to have a look and try to come up with a suggestion how it can be fixed, please e-mail me and I'll send back the imp file.

Any help would be appreciated.

Kind Regards,
Stephen
swartel@nycap.rr.com


Top
 Profile  
 
 Post subject:
PostPosted: November 10th, 2005, 1:56 am 
Offline

Joined: November 28th, 2004, 6:05 am
Posts: 141
Location: USA
Hi Stephen

Send it over, I'll have a look

Cheers
Chris

_________________
Opus Resources and Services


Top
 Profile Visit website  
 
 Post subject:
PostPosted: November 10th, 2005, 5:05 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Thanks, Chris

I've e-mailed it to you.

Kind Regards,

Stephen


Top
 Profile  
 
 Post subject:
PostPosted: November 11th, 2005, 1:10 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi

Thanks to Chris for pointing out the scripting errors.

The project is moving forward again.

One issue that needs solving is how to move scripted actions from buttons directly on to the frames involved. For example, instead of an action placed in a button to clone a frame containing 4 color quadrants/vectors, how does one move this to the frame, so that right or left clicking the frame itself triggers the script action?

It would seem a relatively simple matter to take the button script and place it in the frame with a mouse trigger. But, when this is done, a scripting error in the write/save button shows up: one of those 'called objects not found' error messages.

There are no obvious errors. Same script moved to the very object it is being used for. Can't figure it out, unless frames themselves are incapable of this. If I take the script, place it in a hotspot and place the hotspot on top of the frame, it all works fine. Just not inside the frame itself. If I frame the new hotspot and the original frame, it fails.

I can use the hotspot work-a-round, but it would be better if the action could be placed directly in the frame. The frames are dragabble, so if the viewer accidently moves one before clicking to clone, it will be away from the (transparent and invisible) hotspot and so fail to work.

Any help would be appreciated.

Kind Regards,
Stephen


Top
 Profile  
 
 Post subject:
PostPosted: November 11th, 2005, 4:05 pm 
Offline

Joined: November 28th, 2004, 6:05 am
Posts: 141
Location: USA
Hi Stephen

This should work OK as long as the buttons OnShow
action which initializes the array still exists.

One warning though, using a left click action to generate
the clone will cause frame to clone when it is dragged
and dropped. So maybe you should use a right click.

Cheers
Chris

_________________
Opus Resources and Services


Top
 Profile Visit website  
 
 Post subject:
PostPosted: November 11th, 2005, 5:07 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi Chris

I've run into a bigger snag than the hotspot issue:

The primary purpose in saving and then being able to reset the symbols on the diagram, is to give the viewer the opportunity to change their diagram by moving symbols around, adding new ones and deleting un-needed ones.

When I've previewed, saving, navigating to another page, returning, resetting and then (the critical experiment) changing/moving/adding/deleting symbols, an error message saying "reference to missing object" pops up. So, it appears that the way it is now scripted, it can't perform this critical function.

In my previous diagram-maker version, which had no ability to clone, I stored positions, whether or not color vector/quadrants were showing or hidden, then read and reset these. The viewer could always change these after reset. The major failing with this version was that it limited the number of symbols of each type available (about 25 of each were stacked on top of one another, instead of the unlimited number available in a clone-featured version). Also, the page was clogged with hundreds of actions and many,many variables. Trying to edit that page became super difficult as any action took forever to open, just to make a simple change.

Short of a miracle in scripting the latest clone-featured version, to allow the viewer to clone, drag/drop, save positions and state of color vector display, then read and reset these, and critically be able to change/add/move/delete these upon reset, I'm afraid it's not going to succeed.

I can't figure out how to overcome this obstacle to full-functionality. I may have to be satisfied with the old version, clogged and limited as it is.

Any help with this huge challenge is appreciated.

Kind Regards,

Stephen


Top
 Profile  
 
 Post subject:
PostPosted: November 11th, 2005, 7:10 pm 
Offline

Joined: November 11th, 2004, 4:05 am
Posts: 636
Location: Christchurch, NZ
Hi Stephen,
I know what you want can be achieved, but the amount of detail you give will make this a guessing game, and many of us are too busy for that.
Post a simple example (including your present scripts) demonstrating the problems you want to overcome.

Paul


Top
 Profile  
 
 Post subject:
PostPosted: November 11th, 2005, 7:54 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi Paul

A sample of what I am trying to work on can be made available by e-mail. The number and type of symbols (for pedigrees and genograms) are on separate pages. The last page is just a repository for earlier buttons, etc. If I can get the scripts working for the first 3 symbols, then I would need to apply them to all the rest found on the 2 symbols pages.

So far, the first 3 symbols can be cloned (with the help of a scripted hotspot on each). They can be saved and after navigating away from the page and returning, can be reset. The problem begins after reset, if you try to change the position of a reset symbol, add a new one, etc. Then the error messages pop up. The viewer needs to be able to save a working version of their diagram, be able to return to it over and over, to work on it and complete it, over time.

If I can ever get this issue solved, next would be using an encrypt key for the save to disk text files, that can be read and reset from. When I tried that, using conventional logic and scripting, it also failed. The encryption is to aid the viewer in protecting privacy of potential health information on the diagram.

Any help would be greatly appreciated.

Thanks for your suggestion

Kind Regards,
Stephen
swartel@nycap.rr.com


Last edited by Stephen on November 14th, 2005, 4:00 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: November 11th, 2005, 10:30 pm 
Offline

Joined: November 11th, 2004, 4:05 am
Posts: 636
Location: Christchurch, NZ
I recommend that you always use Debug.trace() statements in your pub scripts -- this is the best way of seeing what your pub is doing (or not doing).

If you have a Debug.trace statement set inside a loop, for example, and the debug window does not appear when you run the pub, then the loop is not running, and you can trace back through the pub to see why.

For example, the script attached to the "save" button, left mouse click trigger:
Add Debug.trace statements to the script like I have done below -- the debug window will always popup if a Debug.trace statement is called.

save = ref + ",";
Debug.trace("ref = "+ref+"\n")
for (var loop=0;loop<ref;loop++)
{
var pos = myClone[loop].GetPosition();
Debug.trace("loop = "+loop+"\n")
Debug.trace("pos = "+pos+"\n")
// String of data for this object
var objdata = pos.x + "," + pos.y;

etc .............
etc ........
}

When you run the pub, clone and drag an object onto the drop area, then hit the "save" button with these three Debug.trace statements in place, you will get the debug window pop up and tell you that ref = 0.
If ref = 0 the "for" loop will not even start as the for statement conditional loop<ref is not true -- the for loop thinks it has finished before it has even started :-)

The other two Debug.trace statements will give no results to the debug window as the loop is dead.

If you then hit the "reset" button, the variable ref is reset to ref = 1, and the next time you hit "save", the loop tries to run then will throw up errors previously hidden by the loop not working.

cheers
Paul


Top
 Profile  
 
 Post subject:
PostPosted: November 11th, 2005, 11:06 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi Paul

Thank you for your ideas. :)

I will try to use debug trace as I move forward, but I have some learning to do to use it properly.

In the meanwhile, the debug trace has revealed the issue causing the difficulty. As a novice (much of the script you see was suggested by others far more capable than I), I'm not quite sure specifically how to remedy this ref=0 issue without messing up the initial and remaining script actions.

Can you suggest a specific change or changes I can make to get the ref (and refa for the second object and refb for the third, and so forth) operating so that when a viewer resets and makes subsequent changes (re-positions, adds, changes the display of one or more quadrants, etc.), they will work? For example, would I set ref to something other than 0 (and where?) or place an "if" clause (again, I can't guess where) to reset ref above 0, "if..."?

Again, thanks for your help.

Kind Regards,
Stephen


Top
 Profile  
 
 Post subject:
PostPosted: November 12th, 2005, 12:25 am 
Offline

Joined: November 11th, 2004, 4:05 am
Posts: 636
Location: Christchurch, NZ
look in the "reset" button scripts to see what is supposed to be setting the ref variable by adding debug statements and see if anything is not right , ie:

in the first script wherever you have the line "ref = something ... " add this on the following line.
Debug.trace("ref = "+ref+"\n")

Comment out the Debug.trace statements in the "save" button scripts as they are not needed at present.

start up the pub, add a few vectors to the drop area and press "reset" two or three times.
See what happens to the ref variable under different circumstances.

It is not uncommon to spend as long debugging a script as it took to write the script in the first place.

As I'm up to my neck debugging someone elses Director pub (and converting old verbose Lingo to Javascript) -- you have my sympathy.

cheers
Paul


Last edited by Paul on November 12th, 2005, 2:51 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: November 12th, 2005, 1:00 am 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi Paul

I'm certainly on a steep learning curve. Atleast I now know how to add debug trace.

What I'm seeing is another story, and what to do with it, I can't guess.

When I added the debug trace to all 3 reset scripts, did several previews, moving items around, I got all different results: mostly on second reset after adding/changing the objects, one or more of the numbers were off, plus I also evoked a couple of 'objects not found' error messages, as well.

When I tried a "logical" remedy, adding a number to ref somewhere in the script, the program crashed, needing the Task Manager to extricate me from a frozen Opus screen.

Times like this, well, I think of simpler times.

Never-the-less, having never used arrays, loops, not knowing their syntax or rationale behind their operation, and not having a real clue what to do when I find a glitch in them, I'm way over my head trying to debug the script, let alone create remedies. :(

I think my grandchildren will figure this out before I do, and I don't even have any grandchildren yet. :lol:

Thanks for your kind assistance. And good luck with your debugging. Knowing what I've been facing, I can certainly sympathize with what you are facing.

Kind Regards,

Stephen


Top
 Profile  
 
 Post subject:
PostPosted: November 12th, 2005, 4:12 am 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi All

Never say never.

Kept at it, with the help of the newest tool (for me): debug.trace, courtesy of Paul (thanks, again).

Found the latest glitches and fixed them.

On to new challenges like taking the actions out of the hotspots and moving them into the objects (if possible) and trying to figure out the write to/read from disk txt file encryption (again, if possible).

Thanks again.

Stephen


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group