Runtime Error, Yet My Teacher Can't Figure It Out, Either. Help!

Anytime I try to enter using TextBox1, this runtime error pops up. This doesn't happen with some of the other choices, yet it's happening a lot, and I don't know what to do, please help. Not even my teacher can figure it out!



Make sure that the list "glasschoice" is initialised with that list of items at all times. Do you set it to be an empty list somewhere ?

Test the value of glasschoice at that point in the code by setting glasschoice to a label

(You would also do well to tidy up your blocks....)

show your screen init bloks if possible.. Showing exact blocks section wont be easy to help by anyone to you.. show the complete event block (button click, after picking, ... etc )

1 Like


Does this help?

You need to show the code in if is in list? thing. TextBox un-Collapsed . Why? Because no one can see what you are trying to do unless you share all your Blocks.

Are you adding trim to what is in the TextBox to eliminate any possible trailing space when text is typed in the TextBox? Some devices add trailing spaces. :cry: if you search for glass and the TextBox is glass_ (with a trailing space, it will not match). The text must match an item in your List exactly!

You possibly should be using those if is in list Blocks in a Logic Block.

Consider posting the aia of your Project so someone can test or use the Debugging tool DoIt to find your issue yourself. It is sometimes extremely difficult to find an issue by inspection of your code alone.

2 Likes

Oops, sorry about that.


Here's the file, too.
crartebh.aia (46.9 KB)

gameError

Your code elicits an error when typing door. My device adds a trailing space so your is in list? Block thinks it is door_ and can not find it in the List, so no match.

At the moment, I would change all your text input Blocks as shown and try again. :slight_smile: There may be many more problems. See what happens when you make the substitution.

This looks like Zork. Your retrograde app probably will be lots of fun when you get it working.

1 Like

This helped with typing the spaces (thank you), yet the runtime error is still happening :frowning_face:

Did you change ALL instances?
allofthem

I get your game 'working' by manually deleting the trailing space before hitting the Enter Button. :astonished: instead of 'fixing' all the instances.

make sure the word you type is really in the List. If not in List provide a notification perhaps.

Use DoIt to check.

1 Like

Yeah, anything I type is in there, yet it keeps showing me a runtime error. When I do it with a companion it does it correctly, yet an error pops up. (Example: If you tell it to go into the door, it'll go into the door, yet displays a runtime error.)

possibly you 'fixed' the first if statement in the EnterButton event handler by using trim. The code processing moves to the second if statement after executing the first and 'messes' up ? Look for an error in the second if statement or a timing issue.
Perhaps doing this elicits the error
setTospace

1 Like

it didn't work :frowning_face: i have no idea what's wrong

I don't know either Jaidyn, however I got your fun app to run :astonished: by disabling the indicated Block and adding trim to ALL the occurrences of TextBox1.Text.

Congratulations, your app now runs here. :slight_smile:

Fix the 'broken' Block and add trim everywhere and your app WILL RUN as it is supposed to.

-- Steve

1 Like

thank you so much!!! :smiley:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.