Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / [SOLVED] Why am I getting this error?

Author
Message
timd35b
3
Years of Service
User Offline
Joined: 5th Oct 2020
Location:
Posted: 7th Jan 2021 05:36
I am playing with an idea and when I run this bit of code I get:
Error: Failed to add text1 - ID already exists in main.agc at line 31



What am I missing?

Attachments

Login to view attachments

The author of this post has marked a post as an answer.

Go to answer

Scraggle
Moderator
20
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 7th Jan 2021 07:33 Edited at: 7th Jan 2021 08:01
This post has been marked by the post author as the answer.
You are creating a text object with an ID of 1. No problem there but you are doing it inside a loop which means that the second time around the loop you are trying to create a second text object which also has an ID of 1, You can't do that because it already exists, hence the error.
You need to move the text creation commands outside of the loop.
timd35b
3
Years of Service
User Offline
Joined: 5th Oct 2020
Location:
Posted: 7th Jan 2021 07:50
Now I feel not too smart. I don't know why I did not see that, it is plain now that you pointed it out.
Thanks scraggle.

Login to post a reply

Server time is: 2024-04-20 09:34:06
Your offset time is: 2024-04-20 09:34:06