Variables swap when I close the Ai2

Hi,

I can't make sense of this -

ai.1

Here's a list of variables.
I close the Ai2 webapp.
I reopen it - it looks like this!

ai2-2

The first changed variable isn't even active! (it has no blocks in it)

Help?

This has been observed before.

But how much effort should be devoted to coders who don't name their procedures?

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