SOLVED///How do I add a value to a inst. var from a string?

Get help using Construct 2

Post » Thu Apr 16, 2015 1:09 pm

Removed the every tick and added a function to only update on events that change values.

Updated Capx

I could have overlooked something, but think it should work..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Apr 18, 2015 1:02 pm

It is 10 times difficult than my technique and when I started implementing yours in my project, I got chaos and texts not showing...
I dont have functions, loops and object instances...
But Iam trying to understand what is going on in your capx..
Give me your e-mail to send you my full capx and you will understand what level of knowledge I have in c2 :)
B
8
S
2
Posts: 110
Reputation: 923

Post » Sat Apr 18, 2015 1:25 pm

Like I said, this is the way I would do it.
I've seen your capx and understand that to you my way might seem complicated.
I only had a short amount of free time, so I didn't add comments.

What I think you might have missed trying to copy/replicate what I did is the "container"
By putting all related objects into a container, there is no need to specify which instance should respond, for they are connected.

The function was added later, only because of my personal dislike for events running every tick if not completely nescessary..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Apr 18, 2015 2:27 pm

This container make texts be created each time a new color is created. Yes, I missed this at the first view, now I noticed.
But even this doesn't clear my mind upon the text appending and other stuff. The only thing I am trying to figure out is what exact event/action changes the sprite.totalweight in Text4. When I understand this, I will be able to accomplish my final step of the project.
You capx is brilliant.
B
8
S
2
Posts: 110
Reputation: 923

Post » Sat Apr 18, 2015 2:45 pm

the value of sprite.totalweight is changed in the events of clicking either the button or the x2.
Text4 only displays the current value of sprite.totalweight.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Apr 18, 2015 2:55 pm

It also displays color and KG. In my project is the same, but the number does not change. This is the main reason such a big thread started :)
I am trying to understand the logics of this result.
B
8
S
2
Posts: 110
Reputation: 923

Post » Sat Apr 18, 2015 3:30 pm

if you want to replace some parts of the StringVariable...you need to know Index and Separator...
..lets say your StringVariable looks like:

Green
50
20p

so...
Green=index 0 ;50=index 1 ;20p=index2
and Separator is "newline"

capx:
http://s000.tinyupload.com/index.php?fi ... 5113411336
Image
B
62
S
23
G
7
Posts: 1,469
Reputation: 10,729

Post » Sun Apr 19, 2015 9:36 am

that's a very nice example and it's pretty close to what I have. I tried to create the else event for substracting, but it is not working. is there a special command for indexes?
B
8
S
2
Posts: 110
Reputation: 923

Post » Mon Apr 20, 2015 3:32 pm

can u please tell me how?
B
8
S
2
Posts: 110
Reputation: 923

Post » Mon Apr 20, 2015 3:46 pm

Ok..let's try one more time...step by step

in capx im upload ..in my previue post...
..what you want to happen next?
Image
B
62
S
23
G
7
Posts: 1,469
Reputation: 10,729

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: pokka and 3 guests