How do I is there a way for variables to do this?

Get help using Construct 2

Post » Fri May 06, 2016 9:11 pm

Hi,

I wander if it is possible for a variable to somehow store more then one number without parsing them trough tokens later. Basically I'd like to store values that are used later in Random expression as (n,n2) and then use them like this : random(variable). Is that possible?
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
89
S
30
G
22
Posts: 1,985
Reputation: 20,099

Post » Fri May 06, 2016 9:27 pm

Tokens are nice to work with though.

variable(text) = str(n1)&"//"&str(n2)&"//"

n1 = int(tokenat(variable(text),0,"//"))
n2 = int(tokenat(variable(text),1,"//"))

r = random(int(tokenat(variable(text),0,"//")),int(tokenat(variable(text),1,"//")))
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Fri May 06, 2016 11:48 pm

I think the answer is no, but it shouldn't really be a problem. random() will accept number values, but not strings. Like 99instances2Go says, either just use tokens (they're easy) or just plug two separate variables into the random expression, as in random(variable1,variable2).
Image



Coming soon on Steam!
B
16
S
9
G
3
Posts: 205
Reputation: 3,468

Post » Sat May 07, 2016 9:15 am

Can still use Cantor pairing.
I would like a cantor plugin.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950


Return to How do I....?

Who is online

Users browsing this forum: AllanR, Artcadev, Google [Bot] and 15 guests