User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 17

Thread: How can I set the RGB of an object to the current value of the line selected on list?

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export Module
    Robotica's Avatar
    Join Date
    Jul 2015
    Location
    Las Vegas, NV and Orange, CA.
    Posts
    263
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question How can I set the RGB of an object to the current value of the line selected on list?

    Hi clickers,

    I have a list that randomly changes the selected line every 00-01' and it has the following entries:

    GetRGB(255, 0, 0 )
    GetRGB(255, 165, 0 )
    GetRGB(255, 255, 0 )
    GetRGB(0, 255, 0 )
    GetRGB(0, 255, 255 )

    And I want to have my white colored object change to the color of the randomly selected line on the list and then delete the line.

    In the event editor I clicked "Effect --> Set RGB Coefficient", but I am NOT able to get the "OK" button to light up and accept my following expression:

    Val( List Select$( "RGB_LIST" ) )

    So clearly it's wrong and I'm not doing this correctly. Any ideas on how I can get this stage of my project working?

    To explain this stage in my game entitled "Visual Acuity" in detail...

    This stage there will be a box at the top of the screen that will randomly select either "Match Color" or "Match Number" and the player will have to shoot the object that corresponds to that requested.
    In this Match Box (as I call it) I will have ONE of five objects appear... each object is a picture numbered 1, 2, 3, 4, 5 and it is colored white so I can change the RGB to one of 5 randomly selected colors on that list (Red, Orange, Yellow, Green or Blue).

    Below the Match Box at the bottom of the screen I will have the 5 objects 1, 2, 3, 4, 5 appear and each will also have a random color applied to it (and color not to be repeated in the bottom 5 numbers).

    To have an idea of what I mean, I did something similar on another stage in my project called "Reaction" where the player only had to hit the circled target of the same color:
    https://youtu.be/VzJ1ERwMQoo?t=2m36s

    reaction_stage__shoot_the_matching_color.jpg

    In that "Reaction" stage I had 6 permanently colored targets and I used two Global Values "colorSelected" and "targetHit". When the target in the Match Box is selected at random I pulled the Alterable Value of that object (simply a permanent number 1, 2, 3, 4, 5, or 6 assigned to each color) and placed it into the Global Value "colorSelected". Then after the player hit the target it changed the Global Value "targetHit" and then I ran event named "Check" just 00-01' after the target was shot by the player comparing the two Global Values to award or subtract points from the player's score.

    I'm thinking for this stage "Visual Acuity" I will need maybe 3 Global Strings instead "typeSelected", "valueSelected" and "targetHit". Each Object will have two Alterable Values (Color and Number) and the "typeSelected" will determine which of the two to change the Global String "targetSelected" to and then again delay an event 00-01' to check it after but I will have to figure that out later and cross that bridge when I get to it.

    This is definitely the most complex of the 10 stages so once this one is out of the way I should be able to finish building the 4 remaining stages and start dealing with the transitions issue I came across. Hahaha. so much work ahead...

    Any guidance or ideas would be spectacular. I appreciate your time! Thanks everyone.

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    Unfortunately you can't enter a function drawn from a list string inside a Val(),
    this will always return 0 because it will interpret that line as a plain string (I suppose)

    You can do this way:

    on triggering event
    >>> (list) set current line to Random(List Nb Lines( "List" ) )
    >>> (object) set RGB coefficient to GetRGB(Val(Left$(List Select$( "List" ), 3 ) ), Val(Left$(Right$(List Select$( "List" ), 7 ), 3 ) ), Val(Right$(List Select$( "List" ), 3 ) ) )

    Your list should be structured this way:
    255,255,255
    123,034,210
    .....

    (only numbers, with commas and trailing zeroes)

    Also, untick the "1 based index" option in the list object properties.

    Should work ok!

  3. #3
    Clicker

    Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCHTML5 Export ModuleiOS Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)Universal Windows Platform Export Module (Steam)
    ratty's Avatar
    Join Date
    Apr 2012
    Posts
    1,165
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)

    How can I set the RGB of an object to the current value of the line selected on list?

    Scheodinger has a great solution. In the past, I've used a different method, though I think I'll switch to the Schrodinger Approach from here on out. Mine relies on string parsing, which seems less than ideal now.

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export Module
    Robotica's Avatar
    Join Date
    Jul 2015
    Location
    Las Vegas, NV and Orange, CA.
    Posts
    263
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmmm, I keep getting Syntax Errors and when I click "Where?" it jumps to the same spot on both expressions... the typing cursor jumps to the L where it says GetList.

    syntax_erros_rgb_coefficient_functions.jpg

    EDIT: oh, maybe because I can't find the "1 base index" option... haha. List Properties that's located on the bottom left hand side? I don't have that listed.

    EDIT2: Found it!

    EDIT3: Still getting Syntax Errors though. =[

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    Argh, my eyes are bleeding
    can't clearly read from the pictures sorry!
    Copy paste your code here so we may check syntax

    edit:
    Maybe I can see one error... since your list seems to be named "RGB_LIST" (from what you say above)
    the code should look like:

    >>> (list) set current line to Random(List Nb Lines( "RGB_LIST" ) )
    >>> (object) set RGB coefficient to GetRGB(Val(Left$(List Select$( "RGB_LIST" ), 3 ) ), Val(Left$(Right$(List Select$( "RGB_LIST" ), 7 ), 3 ) ), Val(Right$(List Select$( "RGB_LIST" ), 3 ) ) )

    Try copy-pasting above text in italics to your expression editor

  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export Module
    Robotica's Avatar
    Join Date
    Jul 2015
    Location
    Las Vegas, NV and Orange, CA.
    Posts
    263
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh yeah, that's weird... the picture got small for no reason even though I uploaded a very large and clear image.

    Here...

    Random(List Nb Lines( "List" ) )

    GetRGB(Val(Left$(List Select$( "List" ), 3 ) ), Val(Left$(Right$(List Select$( "List" ), 7 ), 3 ) ), Val(Right$(List Select$( "List" ), 3 ) ) )

    I copy and pasted exactly what you had... syntax error on both. When I click "where?" the typing cursor jumps to the first L of List Select.

  7. #7
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by schrodinger View Post

    edit:
    Maybe I can see one error... since your list seems to be named "RGB_LIST" (from what you say above)
    the code should look like:

    >>> (list) set current line to Random(List Nb Lines( "RGB_LIST" ) )
    >>> (object) set RGB coefficient to GetRGB(Val(Left$(List Select$( "RGB_LIST" ), 3 ) ), Val(Left$(Right$(List Select$( "RGB_LIST" ), 7 ), 3 ) ), Val(Right$(List Select$( "RGB_LIST" ), 3 ) ) )

    Try copy-pasting above text in italics to your expression editor

    ^^^ have you checked this?
    (reposting because added on editing and it may have gone unnoticed..)

  8. #8
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export Module
    Robotica's Avatar
    Join Date
    Jul 2015
    Location
    Las Vegas, NV and Orange, CA.
    Posts
    263
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yup... copy and pasted exactly. no luck. =[

  9. #9
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    Here's example:
    random_colour.mfa

    Expression is correct (copypasted from above post)
    You still get syntax error?
    Really strange!
    Are you ABSOLUTELY sure your list object's name is "RGB_LIST"?
    Can't think of other things going wrong...

  10. #10
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Location
    UK
    Posts
    1,393
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    Is there any particular reason why you don't just pre-calculate the color values?

    255
    42495
    65535
    65280
    16776960

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Customizable line in a list object
    By Ls2 in forum Fusion 2.5
    Replies: 2
    Last Post: 12th August 2015, 09:47 PM
  2. Selected Object List Object - was it ever made?
    By Dines in forum Extension Development
    Replies: 5
    Last Post: 21st October 2011, 09:34 AM
  3. [BUG] - List object "Set Current line" action
    By Nico in forum Android Export Module Version 2.0
    Replies: 3
    Last Post: 10th September 2011, 12:01 PM
  4. Change List Object Line Color - One Line Only?
    By drnebula in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 21st December 2008, 05:58 PM
  5. List Object can't tell if any line is selected?!
    By jayklik in forum Multimedia Fusion 2 - Technical Support
    Replies: 10
    Last Post: 3rd September 2006, 06:18 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •