How to convert 10 with 1,2,3,4,5,6,7,8,9,10

0 favourites
• 11 posts
From the Asset Store
Creepy Sprite Font suitable font for your Dark/Horror/Halloween games.
• Is their any way of doing this

if i type only 10 and construct convert it to 1,2,3,4,5,6,7,8,9,10

• Try Construct 3

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

Construct 3 users don't see these ads
• No idea what you mean... Convert into what? Loop 10 times?

• You could create a function to do that. Pass in the number entered by the user as a parameter, and then have the function pass back the string of numbers up to that value.

• You could create a function to do that. Pass in the number entered by the user as a parameter, and then have the function pass back the string of numbers up to that value.

How do you return multiple values (unless you're calling it multiple times then store each value)?

EDIT: Ah nvm... String of numbers...

• Assuming that you will always start at 1, and going up to number X:

Set text object text to "1"

For "i" = 2 to X

append text to text object ", "&loopindex("i")

Make sure your text object is wide enough to see all the numbers (if you're feeling clever you could set the width of the text object based upon the value of X )

• but append works only in text object

but it will not work on other like

choose() & others

• If you're looking to use it for randomization purposes, you can't use choose() for a variable set of numbers. You would want to use floor(random(0,ChosenNumber).

For all other purposes, use a counter or reverse counter in a loop, where the number of repetitions is your chosen number. If you really need to, you can take the additional step of pushing each consecutive number to an array, although this should be necessary.

• i have a global variable

i want that to be change

suppose variable is 10

then i want random between 1 to 10

• Ah ok, my misunderstanding. If you want to keep the values as integers as you could push them to a 1D array, as oosyrag says.

• int(random(1,GVariable))

or

• ok i got it thanks oosyrag

i will try it at morning

good knight

• 11 posts