Variables swap when I close the Ai2

why dont show all the code?. its very difficult gave you a solution...

I didn't name them because they are duplicates running the same routine.
Obviously the two unique ones got names ; )

there's all the blocks. It is a timetable to run a morning routine.
If I change the spinner time, it moves the whole timetable later.
I'm sure there's a way to do this with a Loop, but I can't figure out how to bring in the variables. So I just copy and pasted it all.

Here's the .aia
Don't judge me. : )
I have trouble keeping on time in the morning
Morning_2.aia (135.1 KB)

AND if you have thoughts on how to make that into a Loop, I'd love to hear it.

Like -
Count = count +1
set Var(Count) to Current Time (or whatever) --- I don't know of anyway to do that

When an apps' blocks look like a box of combs, it means they have not yet learned how to use lists, procedure parameters, and generic blocks.

Your block count could be reduced by a factor of 10.

http://www.appinventor.org/bookChapters/chapter21.pdf

http://www.appinventor.org/book2

And I plan to!
However, I needed the job done, and it took like an hour. As opposed to going through the entire reading list, which may take me weeks ; )
Someone else suggested I pull the data in and out of Exel/Sheets.
I'll look into all that as I have time.

I like "elder Scrolls" : D

Any thots on the original question - how in the world did Ai2 swap my variables?

Chainsaw Joke

A city dweller buys a house in the country and needs to cut down some trees on his property.

He asks the local hardware store for something to use for his trees, and they sell him a chainsaw.

Two hours later, he returns to the store, all sweaty, torn, and bloodied. He throws the chainsaw down on the counter and complains it doesn't work.

The counterman inspects the chainsaw, verifying it's chain is seated and oiled, and that the gas supply is okay.

The counterman then pulls the starter rope and the chainsaw roars to life.

The customer then jumps back, and exclaims "What's that noise?"

...

"is there anybody else there I can talk to?"

Are you saying, procedure5 and procedure6 magically renamed themselves to Alarm_Snooze and Alarm_Awake?

Taifun

Aside from the procedure problem, here's a draggable generic Button event to replace button clicks for Time1-Time13:


I am working from an uncorrupted project made by doing a Designer Copy (Ctrl-C) of Screen1 into a fresh project.

This leaves behind all those nasty parameterless procedures and chicken feed global variables.

Yes.
In fact, if you look at the list of Procedures, the errant ones are listed between Procedure 5 and 6 - NOT alphabetically. So some sort of glitch in the matrix.
I suspected some sort of corruption, so I deleted the self-relabeling tiles, and deleted the purple Procdedure blocks and redid just one, Alarm_Awake.
It appreared in the list in proper order!
Then I closed and reopened - in the list of procedures in the wrong place and magically took over P5 again.
Very odd.

#ABG - Thank you!
That solution is a thing of beauty.
I've read some on Lists, but still learning them; very powerful.

Don't feel you need to redo the whole project!
I was asking if people already knew what I was doing wrong
It is possilby linked to my simplistic mess.

I don't think it is my computer. I have another large project with 12+ variables, and they have never swapped.

But, I didn't mean to be a drain on your time!

  • Mirt

From your aia, I was able to reproduce your experience.

I deleted the two procedures Snooze and Awake (keeping the blocks therein) then after restarting, and seeing no change in the procedures list, created new procedures for snooze and awake, and aplied their respective blocks. After several restarts no issues with the procedure list.

See if you can break it again :wink:

Morning_2_revised.aia (135.0 KB)

Update - this corruption didn't start right away.

I replaced most of the blocks in that column with the identical ones from an older Checkpoint. So far, no corruption.
But 'Alarm_Awake" is listed between P5 & P6.
I don't know if I need to wait a day; I'll let you know.

Hi, TimAi2,

Thank you. I downloaded your .aia and it looks fine to me too.
I'm not sure how long it takes to corrupt. I've opened and exited several times.

Alright, I've added a new procedure in case that was a trigger,
both to your project and my updated one (see previous post).

Neither has corrupted. I exited the browser and everything.
I'll try again later in case time is a factor.

If it's fixed, I'm thrilled. It may just remain a mystery.

Also, with regard to your blocks coding so far, I came across this article on "tech debt"...

https://wiki.c2.com/?WardExplainsDebtMetaphor

@ABG

2 Likes

I've also installed the app to my phone with Companion, then created an .apk and installed that. Just in case any of this is causing corruption.
It's a day later - still no corruption.

My tentative conclusion is that the Procedure blocks got corrupted at some point.
I just went back to a previous Checkpoint, copied the main blocks with the procedures in it (it's Gold and Green) and most of the blocks around them. It seems fine now.
"Alarm Awake" is still mis-filed in the list of procedures, but otherwise no Swapping.

What TIMAI2 did is also working; again replacing some blocks.

I'll keep you posted if it changes.

Thanks for the aritcle.
This is now getting off the topic of Ai2.
Read only if you want...

The article said, amoung other things -
"I am in favor of writing code to reflect your current understanding of a problem even if that understanding is partial."

Thank you for your support.
For me it's two things -

  1. Time Budgeting - if I have half an hour, 3 times a week, shall I spend that entire time studying, or start being productive? Obviously, it must begin with studying - I did all the basic tutorials, etc. What they showed is mostly the self-evident coding -
    Var = Var +1
    That's intuitive. I've studied coding before.
    You guys are showing me the next level. Like the procedure with an additional Input.
    The equal signs are gone, one needs to Know what the coding block can do. I'm getting there - appreciate your help.

  2. My Personality. I learn by doing. I grew up (I'm old) playing Space Quest - "try and die". The only way to figure out how to get through the screen was walk forward, die, and try again. Obviously it was nurture meeting nature, but for my nature, it was "this is how to interact with computers". I haven't changed.
    One of my kids is just like me.
    Another would read the whole manual first. But probably quit from boredom before they did anything.

Which is to say, it all has to do with Learning Styles. For some of us, trying and seeing what happens is how we learn. Thomas Edison, "We've had success! That's 782 things we now know don't work!"
For others.. they learn differently. They are the ones that are probably glad Edison wasn't experimenting with nuclear physics. ; )

PPS - obviously it's wrong if someone comes here and is asking you to do all their work for them - then they are neither trying nor learning.
Please remember I didn't come here asking you to clean my code up (nor asking to have it judged). Again, I was in a hurry, and i got the job done. I use this daily.
I came here with a mystery about Variables being magically swapped around.

Anyway, this should move to the "off topic" channel. ; )