Unsetting values.

0 favourites
  • 1 posts
  • I have a big list of word, that I'm choosing with tokenat.

    At the end I need 4 DIFFERENT words taken at random from that list.

    The way I'm doing it:

    global list = "bread,table,spoon,cat,dog,house";

    local tmp_current = "";

    Set tmp_current to tokenat( list , floor( random( tokenCount(list ,",") ) ), "," );

    Set list to replace( Emotions_unset, tmp_current &",", "" );

    Set list to replace( Emotions_unset, tmp_current, "" );

    Set text1 to tmp_current;

    ---

    Set tmp_current to tokenat( list , floor( random( tokenCount(list ,",") ) ), "," );

    Set list to replace( Emotions_unset, tmp_current &",", "" );

    Set list to replace( Emotions_unset, tmp_current, "" );

    Set text2 to tmp_current;

    --- repeat for all text

    I don't think is an elegant solution and it give errors sometimes (like double commas) is there an easier (and safer) way to do something like this?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)