Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently November 6th, 2024, 3:27 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: Random Question
PostPosted: April 30th, 2007, 3:21 pm 
Offline

Joined: September 11th, 2006, 2:38 pm
Posts: 125
Is it possible to random a number between 0- 10
but without repeating the same number until all the 11 numbers have finished?


Top
 Profile  
 
 Post subject:
PostPosted: April 30th, 2007, 8:33 pm 
Offline

Joined: November 11th, 2004, 4:05 am
Posts: 636
Location: Christchurch, NZ
It took me 30 seconds to search this forum for the word "random" to find the answer.
The search function on this forum is very useful and might save you a lot of time waiting for an answer.

viewtopic.php?t=1544&highlight=random

Paul


Top
 Profile  
 
 Post subject:
PostPosted: May 5th, 2007, 8:15 pm 
Offline

Joined: September 11th, 2006, 2:38 pm
Posts: 125
Thanks Paul for your answer.
I really tried hard to understand the script that it given for randomize ,But I can't.
I just want a simple script to randmize 10 numbers in turn without repatition.
Thnaks in advance for any help


Top
 Profile  
 
 Post subject:
PostPosted: May 5th, 2007, 11:07 pm 
Offline

Joined: October 25th, 2004, 3:03 pm
Posts: 540
Location: Tyalgum Creek. Australia
Opus: Opus Pro Latest version 9.02 Build 16458
OS: Won 10
System: Asus laptop Intel Core i5 8 gig ram, big monitor, reading glasses
Opuslover

There are many people here who could answer your latest question, but it is better for you to take responsibility for your own learning and put some time and energy into developing your skills and expertise.

Last year I wrote a few Opus script lessons for beginners.

Chapter four uses random script commands to select pages.

http://www.digitalgrapevine.info/viewtopic.php?t=1600

I recommend you begin with chapter 1 and work your way towards chapter four because Chapter 4 assumes you have knowledge and expertise from chapters 1 to 3.

Cheers

Graham

_________________
Too much coffee can result in frequent toilet breaks!


Top
 Profile  
 
 Post subject:
PostPosted: May 6th, 2007, 10:16 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Hi OpusLover,

Not sure what your level of scripting ability is. I've included a publication that only displays your randomised list.

Have a play and see if this can be adapted for your needs.

Mack


You do not have the required permissions to view the files attached to this post.

_________________
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:
PostPosted: May 6th, 2007, 2:31 pm 
Offline

Joined: September 11th, 2006, 2:38 pm
Posts: 125
Mackavi
I really don't know what to say to you. You saved 1000 hours of hard working and gave me the chance to complete my prog.
Thanksssssssssssssssssssssssssssssssssssssss.


Top
 Profile  
 
 Post subject:
PostPosted: May 6th, 2007, 3:39 pm 
Offline

Joined: September 11th, 2006, 2:38 pm
Posts: 125
Mackavi
I have two more Questions.
1. I found that you sometimes don't declare the variable and it shows <myMaxNUmber> in the text file .How this be done?
2. If I have INI file and there are many lines in this file.
What is the script to count the number of the lines.
I really tried GetLIneCount() but it doesn't work or I don't know how to use it.I tried like this:

var sectionData = GetINISectionData("C:\\try1.ini", "Names")

var lines=sectionData.GetLineCount()

Am I on the right track or Not?


Top
 Profile  
 
 Post subject:
PostPosted: May 6th, 2007, 6:35 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Hi OpusLover,

That's OK.

I don't get what your asking for Q1.

Q2 won't work. That command is for use on text objects not text files as far as I know.

To read all the lines from a file, you'd need to set up a loop and read each line incrementing the counter each time until the end of the file is reach. I don't think there is a specific INI command for this, but the standard readline command for files should work.

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:
PostPosted: May 6th, 2007, 7:16 pm 
Offline

Joined: September 11th, 2006, 2:38 pm
Posts: 125
Mackavi
Anyway Thanks for your reply.
Forget about the first Q.
The second one is very important to me.
I can do it but not with script you can try it
I make abutton then add action
Actions>Text>Count Lines
It works fine
and it reads only from "names" in INI
but I want to do the same action with script.


Top
 Profile  
 
 Post subject:
PostPosted: May 6th, 2007, 9:00 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Sorry OpusLover,

misunderstood what you were trying to do. Still won't work. That command is for text objects and you are trying to use it on a text variable.

I would use the following;

var sectionData = GetINISectionData("C:\\1.ini", "names")
var myArray = sectionData.split(String.fromCharCode(10))
var lines = myArray.length - 1
Debug.trace(lines)

This basically converts the string in sectionData to an array and counts the number of cells.

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:
PostPosted: May 7th, 2007, 2:04 am 
Offline

Joined: September 11th, 2006, 2:38 pm
Posts: 125
Thankssssss again Mackavi
That's what I want exactly.
Great Help


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot] and 2 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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group