Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

object.id and retobjectbyid() are undocumented #1183

Open
amreo opened this issue Jul 7, 2018 · 5 comments · May be fixed by colobot/colobot-data#126
Open

object.id and retobjectbyid() are undocumented #1183

amreo opened this issue Jul 7, 2018 · 5 comments · May be fixed by colobot/colobot-data#126

Comments

@amreo
Copy link

amreo commented Jul 7, 2018

There are a (smart) way to uniquely identify a object(like a bot, a enemy bot, a AntSpider, titanium cube, ...) using a string or a int? It's useful for inter-bot communication.
For example:

`
extern void object::run() {
object target = radar(Titanium);
string targetID = target.id;

//from somewhere else
object titanium = getObjectByID(targetID);
//Now 'titanium' should be equal to 'target'

}
`

@tomangelo2
Copy link
Member

tomangelo2 commented Jul 7, 2018

You can get an object with known ID with object item = retobject(something.id); function.

@amreo
Copy link
Author

amreo commented Jul 7, 2018

The object::id is not documented: http://colobot.info/SatComOnline/master/cbot/object

@tomangelo2
Copy link
Member

tomangelo2 commented Jul 7, 2018

That's a good catch. Object.id should definitely be listed there.
[edited: misunderstanding from my side. Sorry about that.]

@krzys-h
Copy link
Member

krzys-h commented Aug 5, 2018

I'm almost sure there was already a report of this being undocumented somewhere, how is that not fixed yet

@krzys-h krzys-h added the SatCom label Aug 5, 2018
@krzys-h krzys-h changed the title GetObjectByID in CBOT object.id is undocumented Aug 5, 2018
@krzys-h
Copy link
Member

krzys-h commented Aug 5, 2018

And @tomangelo2 it's retobjectbyid(), normal retobject uses different ids for backwards compatibility (because retobject can't return nulls other than at the end of the object list)

@krzys-h krzys-h changed the title object.id is undocumented object.id and retobjectbyid() are undocumented Aug 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants