0 Favourites

Unsetting values.

  • 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?

  • Construct 3

    Buy Construct 3

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

    Buy 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)
Similar Topics Posts Views Last Post
Unread hot topic
36 960
LittleStain's avatar
LittleStain
Unread hot topic
32 1,571
Tekniko's avatar
Tekniko
Unread hot topic
0 Favourites
Round / Format a decimal value
26 11,562
Unconnected's avatar
Unconnected