Unsetting values.

Get help using Construct 2

Post » Thu Mar 08, 2012 11:44 pm

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?
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

Return to How do I....?

Who is online

Users browsing this forum: makkancs, Marxally and 30 guests