Math calculations with webstorage

Get help using Construct 2

Post » Sun Dec 21, 2014 5:19 pm

Hello.

I cannot solve that issue. I like to make a caluculation with 2 webstorage values. Does somebody know how to make the below formula work?

Untitled-1.png


Any help would be very appreciated!
Sophia
You do not have the required permissions to view the files attached to this post.
Current Mission: improve design skills
B
10
S
3
Posts: 64
Reputation: 1,267

Post » Sun Dec 21, 2014 5:39 pm

You probably need to use & when using variables inside a string. For example:

xml.StringValue("//magic/*[@id='"&magiclist.command_ID&"']/text()")
B
76
S
29
G
17
Posts: 256
Reputation: 15,275

Post » Sun Dec 21, 2014 5:54 pm

WebStorage saves strings, you need to convert them back to numbers. Use the int() or float() expressions.
IE: int(WebStorage.LocalValue("xxx"))

https://www.scirra.com/manual/126/system-expressions
ImageImageImage
B
71
S
22
G
274
Posts: 3,829
Reputation: 151,301

Post » Sun Dec 21, 2014 6:00 pm

"&" does not work. int(x) does work.

Untitled-1.png


Thanks!
You do not have the required permissions to view the files attached to this post.
Current Mission: improve design skills
B
10
S
3
Posts: 64
Reputation: 1,267


Return to How do I....?

Who is online

Users browsing this forum: Kyledfrank, R0J0hound and 64 guests