Colobot Forum - International Colobot Community
Checking used objects. (ore that was moved) - Printable Version

+- Colobot Forum - International Colobot Community (https://colobot.info/forum)
+-- Forum: [Archive] New forum (2015-2019) (https://colobot.info/forum/forumdisplay.php?fid=76)
+--- Forum: Colobot: Gold Edition Basics (https://colobot.info/forum/forumdisplay.php?fid=58)
+---- Forum: General (https://colobot.info/forum/forumdisplay.php?fid=59)
+---- Thread: Checking used objects. (ore that was moved) (/showthread.php?tid=811)



Checking used objects. (ore that was moved) - clop1000 - 07-02-2016

I am working on the code for a bot, that will be automatically drag a titanium ore to a specific destination (for instance flag, or even better just destination (z,x,y)), find a free space, and go to the next chunk.
And repeat this till the end of times Big Grin.

But i got a problem. Is there any way to check, was this specific piece of rock was already taken by my bot, or not?
I think there is a way - i have to make an Array and add every ore that was moved, and after that check the whole array, before choosing a next target.

But there is some flaws. Let's imagine making check by destination (z,x,y), if ore was moved by me(or another bot) bot would be think that it's a new piece of ore.
if use checking by reference to an object (a piece of ore) to it could to error if this or is consumed (to make a new bot for instance).
How do you advise me to make a program, without using radar function, and playing with its angle parameter.
Main idea for this bot - to only once touching one piece if ore and forever forget about of it.


And last but not least - is there any way to save this information. Just imagine there is some kind of glitch and i have to restart bot's funtion.
And it will completely incredible if there is a way to share this information beetwen different bots. For instance i have 2 bot's that collect ore at the same time


P.S.
Is it possible to make a bot to build something in company mode?


RE: Checking used objects. (ore that was moved) - tomangelo - 07-02-2016

(07-02-2016, 01:24 PM)clop1000 Wrote: Is it possible to make a bot to build something in company mode?

build(); function is available for Grabber bots. In future it will be for Builder bots, but for now Grabbers do this.

(07-02-2016, 01:24 PM)clop1000 Wrote: And last but not least - is there any way to save this information. Just imagine there is some kind of glitch and i have to restart bot's funtion.

I think this is possible with public classes, but I don't know how it exactly works. Somebody else should explain that.


RE: Checking used objects. (ore that was moved) - radioactivity - 07-02-2016

I'm gonna take my opportunity to curse dynamic id system. Should every item get static id, like in original Colobot, you could save list of id's of Titanium which was moved.


RE: Checking used objects. (ore that was moved) - clop1000 - 07-02-2016

(07-02-2016, 02:53 PM)radioactivity Wrote: I'm gonna take my opportunity to curse dynamic id system. Should every item get static id, like in original Colobot, you could save list of id's of Titanium which was moved.

Yeah. If there had been such this i would have been much more easier to realize that.

Maybe just try to check by reference?


RE: Checking used objects. (ore that was moved) - krzys_h - 07-02-2016

There are static IDs added in Gold. Check object.id. You can use that number to get a specific object using retobjectbyid().


RE: Checking used objects. (ore that was moved) - radioactivity - 07-03-2016

(07-02-2016, 07:47 PM)krzys_h Wrote: There are static IDs added in Gold. Check object.id. You can use that number to get a specific object using retobjectbyid().

This is like 8th time I ask for feature and It already exists in game. How do you do it?


RE: Checking used objects. (ore that was moved) - krzys_h - 07-03-2016

(07-03-2016, 02:13 AM)radioactivity Wrote:
(07-02-2016, 07:47 PM)krzys_h Wrote: There are static IDs added in Gold. Check object.id. You can use that number to get a specific object using retobjectbyid().

This is like 8th time I ask for feature and It already exists in game. How do you do it?

I just add random things that sometimes happen to be useful later Tongue