How to generate random objects with a click?

Hi Guys,
I am new to the forum so hello to you all!
I start here with a question that doesn't leave me sleeping during the night.
I am working on a interactive slideshow.
That's all right, ultil now.
Now things becomes blurry for me.
In every page I would like to add a little animal in the lower right angle of the screen so, when u click on this animal, a baloon appears with a wroten sentence inside it.
But, I wanto to make the sentences inside the baloon RANDOMLY different every time u click on the animal (using a selection, for example, of 30 sentences at all), but I don't really know what I have to do in order to realize my idea.
I am not interested to create a preset cycle of sentences, but a random behavior with a click.
any suggestion please?
Thaks a lot and best regards!
Theus

As I imagined,
I got some problems to do do that because I am new to the director use. So I can't made it working, if u cant be a little patient with me please, that's will be good!
What I need is a more "steb by step" help if is not boring for you.
I go to insert>control>field in order to create a field and then, after double ciking the field, I type four example sentences into the text editor that apperars, right?
How I have to write the sentences inside the text editor in order to subdivide the text into first sentence, second sentences and so on? There is a special syntax to follow?
I wrote these exaple sentences:
"Triangle" "Square" "Circle" "Cube"..... As u see, I am not sure where and how I have to put the sentences in order to select them randomy
About handlers.
What I have to do to create an event handler?
I created a button then i rename it ChooseRandomSentence but now I don't know what I need to do to proceed.
Here have I to write this script?
On ChooseRandomSentence
  global gSentenceList, gPreviousNR
  x = gSentenceList.count -- X = count sentences
  y =  random(x) -- Picks a random number from X
  repeat While y  =  gPreviousNR then -- check if number is used previous time player clicked button
      y =  random(x)
   end repeat
  put gSentenceList[y] into field "ShowSentence"  -- Shows random sentence in a field
  put y into gPreviousNR -- add number to next check
end
and this?
on MouseUP
ChooseRandomSentence
end
Some other questions:
-What about letters X and Y into the exaples scripts u wrote? If I have 4 sentences, which numbers I need to use to replace X and Y?
-I need to change sentences with  mouse clicking, and not simply moving the mouse over the sprite or the button, is MouseUP command a script about clicking or about moving over?
As u see I am a very very beginner but I really want to learn, so hope I don't boring u with all those questions.
Thanks again a lot
and, If u came in Italy, there is a beer for you! cheers!!!
Theus

Similar Messages

  • How to generate random numbers with a known distribution of f(X)=(8X^2 + 1)*Exp( -X^2 )

    Dear All,
    I need to simulate a random number generator which can generate numbers X with the probability distribution of 
     f (X) = ( 8X^2 + 1)*Exp ( -X^2 ).
    This distribution is not a common distribution.
    I have searched a lot, but I still do not know how to realize it.
    Any help on this topic would be highly appreciated.

    Make a lookup table of the integral of your function (normalized to 1)
    Use the rectangle random generator and pipe that value through the lookup table, scale it ... voila.
    Greetings from Germany
    Henrik
    LV since v3.1
    “ground” is a convenient fantasy
    '˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'

  • How to generate random numbers with a known distributi​on f(X)=(8X^2 + 1)*Exp( -X^2 ).

    I need to simulate a random number generator which can generate numbers X with the probability distribution of 
     f (X) = ( 8X^2 + 1)*Exp ( -X^2 ).
    This distribution is not a common distribution.
    I have searched a lot, but I still do not know how to realize it.
    Thanks a lot!
    Solved!
    Go to Solution.

    Don't forget to index back into the original X array for correctly scaled data. Here's a simple example (LV 8.0):
    Seems to work just fine.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    DistributionSimulation.png ‏25 KB
    DistributionSim4.vi ‏44 KB

  • How to separate an object with a 3d effect

    How to separate an object with a 3d effect
    Hi, I have outlined some text and applied a 3d effect but now I want to separate each letter so I can adjust the colour on the face of the letter with the colour on the extruded part.
    I am sure it is probably straight forward but could do with a little help!
    Thanks

    I think what the OP wants to do is to keep the extruded part the same color and change the face of the letters to different colors. And he/she did mention that the text is outlined.
    If that's the case, I can think of two things to do if you want to keep the 3D effect live (i.e., unexpanded).
    1. You could apply a stroke to the outlined text, in the color you want for the extruded part. Then just change the fills individually (Tip: view in Outline mode and use the Group Selection tool to select each letter).
    2. If you don't like how the stroke looks on the letters, make all the letters the same color — the color you want for the extruded part. Then make a copy of this group of letters. Select the copy, then click in the Appearance panel to to edit the 3D effect. Put the Extruded Depth at Zero. Now chnage the colors to your liking, then align them with the original. Interestingly, you can't just use the Align functions, you have to eyeball it.

  • How to generate random password as per password policy by knowing the resou

    Hi,
    Any body tell me, how to generate random password as per password policy by knowing the resource object in OIM11g
    Regards,
    Nishith Nayan

    Hi Nayan,
    You can try below code snippet:
    UserRepository ur = new DBUserRepository();
    UserInfo user = ur.getUserInfo(userKey);     
                   ResourceRepository rrepo = new ResourceDBRepository();
                   Resource resource = rrepo.findResource(resourceName);
                   PasswordPolicyAssignmentsRepository par = new PasswordPolicyAssignmentsDBRepository();
                   PasswordPolicyRepository ppr = new DBPasswordPolicyRepository();               
                   List passwordPolicyAssignments = par.getPasswordPolicyAssigments(resource);     
                   PasswordPolicy passwordPolicy;     
                                            PasswordPolicyAssignment passwordPolicyAssignment = (PasswordPolicyAssignment) passwordPolicyAssignments.get(0);
                             if (isApplicable(passwordPolicyAssignment, getMappedAttributes(userInfo.getAttributes()))) {                            
                                  passwordPolicy = ppr.find(passwordPolicyAssignment.getPasswordPolicyID());                    
                                                 RandomPasswordGeneratorImpl rpg = new RandomPasswordGeneratorImpl();
                             password = rpg.generatePassword(userInfo, passwordPolicy);
    regards,
    gyan

  • How to generate random numbers from 1 to 5

    How to generate random numbers from 1 to 5   
    -1110340081
    Solved!
    Go to Solution.

    (You should not mark a post as solution unless it actually contains a solution to the original problem)
    Do you want to share your code? Did you test to make sure that all numbers equally probable?
    LabVIEW Champion . Do more with less code and in less time .

  • How to call a form with dabble clicking on a record with one time where

    Hi All,
    How to call a form with dabble clicking on a record with one time where clause. I mean when i dabble click on the current record i want to call another form with details of the
    record with onetime where clause. Can anyone help me in this regard.
    Now i am calling a form with parameter with onetime where but this should avoid.
    Thanks in advance
    Arif

    Hello,
    I mistakenly mark it as solved. There is a problem remain. when i placed the code below it do not execute with the where condition. I mean the condition to execute is not work.
    All records executes. Please correct my code--
    Here the WHEN-BUTTON-PRESSED-trigger on the Edit-Button:
    :GLOBAL.MODE:='EDIT';
    :GLOBAL.REQ_ID:=:PROBLEM_REQUEST.REQ_ID;
    CALL_FORM('REQUEST_ID_PARAM',NO_HIDE,DO_REPLACE,NO_QUERY_ONLY);And also, WHEN-NEW-FORM-INSTANCE-trigger of REQUEST_ID_PARAM:
    DEFAULT_VALUE(NULL, 'GLOBAL.MODE');
    DEFAULT_VALUE(NULL, 'GLOBAL.REQ_ID');
    IF :GLOBAL.MODE='EDIT' THEN
    GO_BLOCK('PROBLEM_REQUEST');
    EXECUTE_QUERY;
    SET_BLOCK_PROPERTY('PROBLEM_REQUEST', INSERT_ALLOWED, PROPERTY_FALSE);
    END IF;Arif

  • How to generate random letter?

    i know how to generate random numbers but is there anyway to generate random letters? or colors?
    thanks in advance..

    marufai wrote:
    -uj-
    as i'm new in java...can u show me how to make random number from array list?
    i tried but it seem long
    ArrayList ma = new ArrayList();
         ma.add("A");
         ma.add("B");
         ma.add("C");          
         ma.add("D");          
         ma.add("E");
         num = gen.nextInt(5);
         System.out.print("" + ma.get(num) );
    so if i wan generate btw A to Z am i suppose to type A to Z out?
    Edited by: marufai on Sep 24, 2007 12:32 PMI like uj's method since it's more extensible, even though it's a little more work up front.
    If you have a range, say A to Z, then loop over the characters in that range, adding them to the list.
            List<Character> list = new ArrayList<Character>();
            for (char index = 'A'; index <= 'Z'; index++) {
                list.add(index);
            }Do that for all of the ranges that you want to add to the possibilities, and then choose random numbers between 0 and the length of the list.

  • Anyone know how to generate random midi in real time? part 2

    anyone know how to generate random midi in real time?
    http://discussions.apple.com/thread.jspa?messageID=11342321
    This article was archive so I can't reply to this, but I wanted to bring this back up.
    As Christian pointed out on converting your notes to P-Press, then random DataByte 1 then convert back to a Note...
    I used this approached but was able to add in a macro I created to save the generated random DataByte 1 so that when the Note OFF message came around, I can apply that saved random DataByte 1 to the Note OFF in question.
    One thing I did notice when working this out was there's 2 differences in processing the messages when it comes to using a MIDI Input Device or a MIDI Performance (midi file).
    After I was able to figure this out, now I can randomize on notes using either of the 2 Inputs.
    While randomize notes probably won't sound nice to the ear, I apply another macro I created and I'm still adding too, and that's Music Scales.
    So while I randomize notes, when applied to this last macro, the random notes now get mapped to notes in a music scale of your choosing.
    This link shows what I did.
    http://www.digimixstudios.net/RandomizeNotesUseScales/
    I'm currently in the process of creating video tutorials in breaking down the whole process but I wanted to share what I have and see if there's any interested in this.
    Remember, this is just one approach and I hope it gives others ideas to work off of.

    anyone know how to generate random midi in real time?
    When I used to drink a lot... this was no problem at all!
    pancenter-

  • How to generate Java objects from XML files with out  scema compilation

    Dear participants,
    My name is Raghavendra , i have a requirement of reading XML files Dynamically and parse them and create java types for manipulation . i will not be provided with sxd files (no schema compilation )coz no one knows how many types of structures are there. i want a generic solution. Please Help.
    Thanks ,
    Raghavendra Ach
    you can mail me to " [email protected]"

    georgemc wrote:
    You could also look at something like Apache Digester, which will parse your XML and populate Java objects with the data. A slightly steeper learning curve than the lower-level APIs such as JDOM, but that's outweighed by the lesser development effortdon't think that would work for the original problem, which seemed to indicate that the xml had an unknown structure.

  • How to generate random list of size n

    Hey its me again, my linked list implementation is working fine but i am having problems with one of the constructors of MyLLSet (a class which represents the linked list implementation of a set of integers)
    class must have two constructors : one which takes no
    arguments and creates an empty set (DONE)
    and another which takes a positive integer n as
    input and generates a set of size n with random elements (no duplicates) ,*problem comes in*, How do i generate a random list anyways? where do i get the random values from?
    again i am new to programming
    Here is my Node class that i created
    public class Node<Value> {
    Value element;
    Node<Value> next;
    Node(Value data)
                element=data;
                next=null;
            Node(Value data, Node n)
                element = data;
                next    = n;
    }and the question is how do i make the second constructor of MyLLSet
    private Node<Value> head;
    ..... // first constructor
    public MyLLSet(int n){
        head=?      ( how do i generate a random list of size n?)
    // implementation of methods form the interfacethanks
    Edited by: haraminoI on Mar 23, 2009 2:24 PM
    Edited by: haraminoI on Mar 23, 2009 2:25 PM
    Edited by: haraminoI on Mar 23, 2009 2:26 PM
    Edited by: haraminoI on Mar 23, 2009 2:26 PM
    Edited by: haraminoI on Mar 23, 2009 2:27 PM

    haraminoI wrote:
    doremifasollatido wrote:
    Keep the dummy if you want. It confused me (maybe because I hadn't seen it in ages, if ever), but if you understand it, the dummy is fine (it's apparently a standard way of writing linked lists).
    Generally, it is not advisable to call an overrideable (non-final with public, protected, or default [package-access] modifier) method from a constructor. But, if you disregard that advice for the moment, you could try calling 'add' with your nextInt, and repeat calling add until the size() of the set is n. That's certainly the easiest way to do it (otherwise, you'll have to repeat your 'add' code, with its check for duplicates, in the constructor).
    while (size of set < n) {
    add(new_random_int);
    }Your code for generating the random integers themselves is correct.
    Do you understand the above code?hey !
    Yes i understand that code, it probably is the easiest way,
    but when the random object generates a duplicate number, wont the add function output the duplicate error message?
    Edited by: haraminoI on Mar 23, 2009 5:11 PM
    public MyLLSet(int n){
        head=new Node(null);
        Node<Integer> p=head;
    Random R =new Random();
    int count=0;
    while(count<n){
        this.add(R.nextInt(n));
    count++;
    }And it works,
    but since my add function does nothing on duplicates,
    the code u mention doesnt reuturn a list of size n, because when the add method encounters a duplicate, it doesnt consider it, so the set size gets 1 node smaller, so if there are like 3 similar numbers generated form the random method, the set size become 3 nodes smaller,
    now how do i add three more non-duplicating nodes to the list
    below is my add method
    public void add(Integer v){
        Node<Integer> p;
        Node<Integer> q;
        p=head;
        while(p.next!=null){
            p=p.next;
        if(this.isIn(v)){
               // does nothing on duplicates
        else
        p.next=new Node(v,null);
    } thanks

  • How to generate random password

    Hi Experts,
    i using some cmdlets to generate random password.
    $ascii=$NULL;
    For ($a=97;($a –le 122);$a++) {$ascii+=,[char][byte]$a }
    $No_of_password  = 6
    $length_of_password = 10
    $TempPassword=$NULL     # To store single password
    $Morepassword=@()  # Variable to 'X' no. of passwords
     for ($lp=0; $lp -le $count; $lp++ )
    For ($loop=1; $loop –le $length; $loop++)
        $TempPassword+=($ascii | GET-RANDOM)   # this generate the random password
    $morepassword[$lp]= $TempPassword 
    $morepassword    # This should give the all random password
    Output is like --- 
    =zM;HFuElY
    =zM;HFuElYp88<kqTOVM
    =zM;HFuElYp88<kqTOVMfS1xR01VzY
    =zM;HFuElYp88<kqTOVMfS1xR01VzY4<$wG%Z>ft
    =zM;HFuElYp88<kqTOVMfS1xR01VzY4<$wG%Z>ft=a&ME7>&3T
    =zM;HFuElYp88<kqTOVMfS1xR01VzY4<$wG%Z>ft=a&ME7>&3T$98v$b>jSU
    This is not required output. It should give the output like
    =zM;HFuElY
    p88<kqTOVM
    fS1xR01VzY
    4<$wG%Z>ft
    =a&ME7>&3T
    $98v$b>jSU
    Total 6 passwords with a length of 10
    How do create a array like this ?

    I agree with Fred but here i shwo to manage two loops with PowerShell.
    $pwdchars=33..122|%{[char]$_}
    1..6|
    ForEach-Object{
    $pwd=''
    1..10 |
    ForEach-Object{
    $pwd+=$pwdchars | GET-RANDOM
    $pwd
    It is usually always better to write less code and to use the code correctly.  YOu have guessed at mmost of the code but have not used consistent variables.  My guess is that you have tried to modify somecode you found.  Look at this code
    to see how easy it is to build loops in PowerShell
    ¯\_(ツ)_/¯

  • Anyone know how to generate random midi in real time?

    Hi this is my first post so if this is obvious please forgive me
    I'm a John Cage fan and interested in chance generated working methods.
    What i'd like to know is if there is a way to generate random midi events (pitch and velocity) in logic pro or mainstage from an incoming midi signal e.g. any incoming note trigger could trigger any midi note randomly within a user defined range in real time?
    Also is it possible to generate random midi events by just letting something run in the background?
    NB i know i can randomise events after the fact using the transform window - i just can't work out how to randomise in real time.
    sorry if this was a dumb question but any help would be greatly appreciated
    thanks in advance

    christianobermaier wrote:
    Random notes are difficult because a MIDI Note actually consists of two events, Note On and Note Off a while later. If you transform either to something random, you'd get hanging notes all over the place especially when doing it live.
    You are quite right Christian, but I still think there are some ways to solve that in the Environment. For some reason I created such a tool in the pass ( it was a Logic custom offer or something like that ... ). I just converted this old LSO to L8 project. Here is a short description of the Macro "Elements" below:
    *INPUT NOTE RANDOMIZER - ELEMENTS*
    1."On/Off" CC# Assign box - you can set any CC# 0-127 here to control the Global ON/OFF Macro button(2) externally.
    2.Global ON/OFF Macro button - switches the Macro ON/OFF. In OFF mode the macro is bypassed.
    3.Note Pitch Low Randomization range box - determines the low range randomization value.
    4.Note Pitch Top Randomization range box - ( determines the top range randomization value ).
    5."Panic" CC# Assign box - you can set any CC# 0-127 here to control the "Panic" button (6) externally.
    6.Panic Button - resets any playing or hanging notes in both Macro ON/OFF modes.
    7.Note Velocity Low Randomization range box - determines the low range randomization value.
    8.Note Velocity Top Randomization range box - ( determines the top range randomization value ).
    Note: +There is a Stand Alone Macro layer in the template project so the macro tool can be easy imported as an Environment layer into other Logic projects. The tool is Polyphonic ( no Voice Limiter is applied ) so you can use it to generate random chords playing same chord rhythmically etc.+
    Also is it possible to generate random midi events by just letting something run in the background?
    I think so - something like Arpeggiator object may do the job as a Note generator in a combination with some Enviro gear or Macro...
    *Live Input Logic Note Randomizer v1.0* - [DOWNLOAD|http://audiogrocery.com/files/innote_randv1.0.zip]
    !http://img59.imageshack.us/img59/699/innoterand.gif!
    !http://img59.imageshack.us/img59/4967/aglogo45.gif!

  • How to use neutralzone object with alarm object?

    I need to monitor a tank level for alarm conditions.  I have created an alarm object so the user can specify values for the lolo, lo, hi, and hihi.  This works fine, except if the tank level hovers around an alarm level setting, too many alarm records are generated.  The Lookout Help page for the alarm object says to use a neutralzone object to filter out the minor fluctuations, but I can't find any details on how.  So how do I do this?  Can I use one alarm object with one neutralzone object for the four alarm settings, or one alarm object with four neutralzone objects, or four alarm and neutralzone object pairs?  How do I connect them?
    Many thanks,
    Ken

    Another method would be to add a delay before alarming using a DelayOn timer.  
    Ryan's suggestion would work, but if the process requires decimal precision you cannot use that method.
    Mike 
    Forshock - Consult.Develop.Solve.

  • How to setup Send Object With Note

    Hi all,
    I was trying to send a message to external email.
    So, for eg, in ME23N, I click on this "Send object with note" to a address which is type U.
    And in SCOT, business object is send as htm file type.
    However, when I receive this mail that i send, there is no url being generated.
    Below is the content of the email:
    If you are not forwarded automatically, use the following link:
    If the link is not to a valid server, log on to the SAP system and check the following object:
    System:     DEV
    Client:     123
    BOR Object Type:     BUS2012
    BOR Object Key:     4000000001
    Which setting am I missing?
    FYI, I'm using ECC 6. Extended notification has been setup.
    Thanks
    Edited by: Jack Wong on Jan 24, 2008 5:07 AM

    Hi Martin,
    Thanks for your reply.
    However, I don't think it's because of the mail server deleted the attachment.
    The htm file is attached to my external mail.
    And the htm file said that it will forward me to the link.
    I'm wondering which setting am I missing.
    Thanks.

Maybe you are looking for

  • How do I set images, specifically, .gif's to loop once or continually?

    When I set up FF 4.0, I remember a setting to have images that are animated in some way (gif's mostly) loop only once. I'd like to unset this feature and can't find where I did it. Might anyone have a big arrow pointing toward the right settings menu

  • What is this kernel panic?

    hi guys, please help me to understand what is this kernel panic (it happened after wake from sleep, and i haven't any external device on usb): thanks Interval Since Last Panic Report:  177350 sec Panics Since Last Report:          1 Anonymous UUID:  

  • Why does CS6 quit when opening CS4 docs in InDesign?

    We just downloaded InDesign, Illustrator, Acrobat and Photoshop in Creative Cloud. But when opening InDesign docs made in CS4 the CS6 version immediately crashes. But when reopening the document is there, but nonamed and not with all links remained.

  • I got a new iPad how do I get my photos onto it from my Old iPad

    I got the new iPad I currently have the iPad 1 before that I cannot figure out how to get my Photos from my old iPad to my new iPad please help

  • Still getting errors when I try to render

    I've been working on a title and last week when i went to render I got an error message  saying: "After Effects error: crash occurred while invoking effect plug-in "Shatter". then followed by a second message "After Effects error: Crash in progress.