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
8
S
1
Posts: 57
Reputation: 1,003

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
75
S
29
G
17
Posts: 256
Reputation: 15,250

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
241
Posts: 3,734
Reputation: 134,494

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
8
S
1
Posts: 57
Reputation: 1,003


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 27 guests