Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently May 18th, 2024, 7:51 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: code needed
PostPosted: November 26th, 2015, 10:18 pm 
Offline

Joined: November 26th, 2015, 10:04 am
Posts: 2
Location: australia
Opus: pro 7 developer version
OS: windows 7
System: laptop think pad
hi, I hope someone can help with some code, what I want to do is: I have 3 variables input1 with 6 entries , input2 with 90 entries and input3 with 90 entries, what I want to do is get a random line of text from each variable and send to variables output1 output2 output3. :D

publication type exe
i use opus pro 7


For this message jayg1000 has been thanked by : mackavi


Last edited by jayg1000 on November 27th, 2015, 9:19 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: code needed
PostPosted: November 26th, 2015, 10:38 pm 
Offline
Godlike
Godlike
User avatar

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

Add a profile using the 'user control panel' in the top right including your Opus Version. And also include what Publication Type you are building for in the post and then we'll know where to start.

</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: code needed
PostPosted: November 30th, 2015, 9:40 pm 
Offline

Joined: November 26th, 2015, 10:04 am
Posts: 2
Location: australia
Opus: pro 7 developer version
OS: windows 7
System: laptop think pad
can anyone help with a little code, i have 3 variables input1 with 6 entries, input2 with 90 and input3 with 90, what i want to do is get a random line of text from each and sent to variables output1, output2, output3
publication type exe
i use opus pro 7


For this message jayg1000 has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: code needed
PostPosted: December 1st, 2015, 10:36 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Concordance of sentences is probably not going to be simple but the bases of what is needed is:

Code:
myString = "The cat sat on the mat. It's Christmas! The dog, in the house next door, slept on the rug. Who killed Kenny? The fish swam in the bowl."


myLength = myString.length;
myLines = new Array();
myIndexA = 0;
myIndexB = 1;
myLineNumber = 0;


while (myIndexA < myLength){
   if (myString.charAt(myIndexB) == "." || myString.charAt(myIndexB) == "?" || myString.charAt(myIndexB) == "!"){
   myLines[myLineNumber] = myString.substring(myIndexA,myIndexB+1);
   myIndexA = myIndexB+2;
   myLineNumber++;
   }
myIndexB++;
}


myRandomLine = myLines[String.random(myLines.length)]
Debug.trace(myRandomLine)


</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  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

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