Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 22nd, 2024, 11:52 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Random Pages
PostPosted: January 22nd, 2014, 2:29 pm 
Offline

Joined: November 21st, 2004, 1:15 pm
Posts: 39
Location: Wales
Opus: Opus Pro v9.5
OS: Windows 7 & Windows 8
System: iMac (with Bootcamp dual boot for Windows) + Sony VAIO laptop
I have a front menu page in my publication and using the option 'Go to Page <random>' works fine to choose a page from two other pages in the same chapter.

However what I'd like to have is:

Option 1 in the Menu (Page 1) - Selects at random Page 2 or Page 3
Option 2 in the Menu (Page 1) - Selects at random Page 4 or Page 5
Option 3 in the Menu (Page 1) - Selects at random Page 6 or Page 7, and so on

I understand that 'random' works on the basis of pages in the same chapter. I can't find a way to select a given number of pages to be included in one particular random option, ignoring other pages in the same chapter. I could place pages 4 and 5 in the next chapter, but that would then be in a different chapter to the main menu. Is it possible to achieve the required selective 'Go to Page <random>' as outlined above?

I'm using Opus Pro 9.02 on Windows 7.

Thanks


For this message dpj has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: Random Pages
PostPosted: January 22nd, 2014, 9:55 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
There's a profile link at the top right - you can add your Opus version - details there.

As for the problem, add the names of the pages to an array; generate a random number based on the length of the array and use the go to page function with the select array element.


Code:
//names of pages
myArray = new Array ("pageOne","pageThree","pageNine")

//random number
r = String.random(myArray.length)

//output page name and go to that page
Debug.trace(myArray[r])
GotoPage(myArray[r])



Mack
https://twitter.com/imsmackavi

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: Random Pages
PostPosted: January 24th, 2014, 4:07 pm 
Offline

Joined: November 21st, 2004, 1:15 pm
Posts: 39
Location: Wales
Opus: Opus Pro v9.5
OS: Windows 7 & Windows 8
System: iMac (with Bootcamp dual boot for Windows) + Sony VAIO laptop
Thanks - I'll give that a try.


For this message dpj has been thanked by : mackavi


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 19 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