Saving Numbers

Get help using Construct 2

Post » Wed Nov 27, 2013 9:07 am

Hello, i'm working on a program for my work, as a night auditor at a hotel, and thought making a program do my work was easier than doing it my self - (work smarter, not harder) but the problem I've encountered is, i guess i don't know how to save a number, and manipulate it correctly. for instance. i need to enter many numbers in, save them, and then later throw them out and add,subtract,multiply and divide them. some of them saving as a new variable. i made this easily on an excel spread sheet, but figured it'd be nice if i made it stupid simple for anyone to do this. i originally thought arrays, but then i guess i don't understand them the way i thought i did, here the first page of my project.

https://www.dropbox.com/s/46057oa091lj2qx/NightAudit.capx
B
5
Posts: 33
Reputation: 316

Post » Wed Nov 27, 2013 9:23 am

Looks like it should be pretty straightforward.

You could almost exactly copy your excell file, just have events to calculate the things that are calculated.

Example for adding:
Every tick Set Array.At(6,6): Array.At(3,6)+Array.At(4,6)+Array.At(5,6)

You could ofcourse add events to only change things when valuea are changed.

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 » Wed Nov 27, 2013 9:59 am

i think i'm stuck on getting the TEXT BOX to save an amount to the Array. currently, i have When press next - it moves the array counter forward by one, and also saves set value at Array (arraymovement,1) and then resets the text box to ""(auto zero if no text). i have a debugger text box to show the what my number value of (1,1) is, and i think i set my array to be 1 row, with 100 slots. like i said im sure im screwing up the array somewhere.

re sharing the cap https://www.dropbox.com/s/46057oa091lj2qx/NightAudit.capx
B
5
Posts: 33
Reputation: 316

Post » Wed Nov 27, 2013 10:09 am

I'm not quite sure what you are doing with the ArrayMovement variable.

Also, when ok button clicked you add 1 to arraymovement, but I don't see you setting any values in your array.

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 » Wed Nov 27, 2013 10:10 am

my text box type was text. rechecking stuff now...
B
5
Posts: 33
Reputation: 316

Post » Wed Nov 27, 2013 10:11 am

line 4 should have been setting a number in my array
B
5
Posts: 33
Reputation: 316

Post » Wed Nov 27, 2013 10:12 am

arraymovement, was a variable that moves the spot im putting a number, so that if a mistake was made ,yo can go back, and it just moves the place holder.
B
5
Posts: 33
Reputation: 316

Post » Wed Nov 27, 2013 10:24 am

To set a value in an array you have to use:

Array set value at.

Line 4 just adds one to arraymovement and sets the text to "" and sets the textbox variable to the uid of the textbox. I'm not sure what that is supposed to do?

You'd probably want to set the array value at (I don't know which coordinate) to int(textbox.text), after that you can reset your textbox and set the textobject you'd like to show the arrayvalue to array.At(which coordinate you've chosen)LittleStain2013-11-27 10:24:44
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 » Wed Nov 27, 2013 10:30 am

The array is much like an excell sheet.
Just imagine A1 to be Array.at(0,0) B1 to be Array.At(1,0) etcetera.
That means A2 is the same as Array.At(0,1) B2 Array.At(1,1) etcetera.

Through events you can set these values and create new values based on the values entered, much like adding formulas in excell.
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 » Wed Nov 27, 2013 10:36 am

i got it working correctly, you've been a huge help! thanks a ton!
B
5
Posts: 33
Reputation: 316

Next

Return to How do I....?

Who is online

Users browsing this forum: Alvaro2, Hadyurik and 9 guests