Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently May 19th, 2024, 4:12 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Bingo!
PostPosted: September 5th, 2017, 7:49 pm 
Offline

Joined: May 16th, 2008, 4:50 pm
Posts: 368
Location: Berghem The Netherlands
Opus: Opus Pro 9.75
OS: Windows 10
System: `HP
Hi Opus friends,

The schools started this week here in the Netherlands and the first thing the teacher of my son asked me if
i had of can make a Bingo program.
Who can help me with a bingo script? Layout is not important but It would help me very much if i can have a script.

Kind Regards,
Ad

_________________
Opus Pro v9.75
Windows 10 on HP EliteBook i7
http://www.csnmedia.nl


For this message Ad Mulders has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: Re: Bingo!
PostPosted: September 5th, 2017, 10:16 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
generate an array containing numbers 1-100 in a random order:

Code:
myBingoNumbers = new Array;
doRandomRotate(100)

function doRandomRotate(len){

for (var i=0;i<len;i++)
      myBingoNumbers[i] = i+1

while (--len ){
   var j = Math.floor( Math.random() * (len + 1 ) )
   var tempi = myBingoNumbers[len ]
   var tempj = myBingoNumbers[j]
   myBingoNumbers[len] = tempj
   myBingoNumbers[j] = tempi
   }

for (var i=0;i<myBingoNumbers.length;i++)
   Debug.trace((i + 1) + ':- ' + myBingoNumbers[i]+'\n');
}


</mack>

_________________
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: Bingo!
PostPosted: September 6th, 2017, 12:53 pm 
Offline

Joined: May 16th, 2008, 4:50 pm
Posts: 368
Location: Berghem The Netherlands
Opus: Opus Pro 9.75
OS: Windows 10
System: `HP
Thanks Macavi!

_________________
Opus Pro v9.75
Windows 10 on HP EliteBook i7
http://www.csnmedia.nl


For this message Ad Mulders has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: Re: Bingo!
PostPosted: September 14th, 2017, 8:57 pm 
Offline

Joined: May 16th, 2008, 4:50 pm
Posts: 368
Location: Berghem The Netherlands
Opus: Opus Pro 9.75
OS: Windows 10
System: `HP
Mac, the script is working fine. I need to show the numbers one by one after hitting a button.
Now all numbers show up at once.

Can you tell me how to do that.

Kind Regards,
Ad

_________________
Opus Pro v9.75
Windows 10 on HP EliteBook i7
http://www.csnmedia.nl


For this message Ad Mulders has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: Re: Bingo!
PostPosted: September 20th, 2017, 8:52 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Sorry, didn't see the reply.

The bit of code..

Code:
for (var i=0;i<myBingoNumbers.length;i++)
   Debug.trace((i + 1) + ':- ' + myBingoNumbers[i]+'\n');
}

... simply reads through the whole array of numbers automatically by increase the index - i.

If you want to only show one number at a time, you'll need to increment the index manually.

1. Create a page / publication variable myIndex and set the number value to zero (0).

2. Add the array value to the page by adding a text box and using insert variable > Constant Expression ... add the following code:

Code:
myBingoNumbers[myIndex]

3. Add a Button to the page and then add a Script Action to the Mouse Trigger ... add the following code:

Code:
myIndex = myIndex + 1


Now when you click the button, the index value goes up by one and the constant expression changes to display the next value in the array.

At some point the index value will be higher that the number of numbers in the array but we'll save that bit until you've got this working first.

</mack>

_________________
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


For this message mackavi has been thanked by : Ad Mulders


Top
 Profile Visit website  
 
 Post subject: Re: Bingo!
PostPosted: September 20th, 2017, 2:55 pm 
Offline

Joined: May 16th, 2008, 4:50 pm
Posts: 368
Location: Berghem The Netherlands
Opus: Opus Pro 9.75
OS: Windows 10
System: `HP
Thanks Mac. I will try it right away!

_________________
Opus Pro v9.75
Windows 10 on HP EliteBook i7
http://www.csnmedia.nl


For this message Ad Mulders has been thanked by : mackavi


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

All times are UTC [ DST ]


Who is online

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