creatures caves welcome, guest
downloads   gallery   dev   community   creatchi   forum   mycaves
bookmarks | search | post new topic
Development Forum
old
moving an agent   
Horstj

Horstj
Germany  


  6/17/2011

I want to inject an agent with ject "agentname.cos" 6 and than move it to a diffrent place. of course I'll make it with INST and SLOW (to avoid autokill), but how do I target that agent (or agents in case the cosfile injects more than one)?
 
Papriko
Peppery One

Papriko



  6/17/2011

Inside the cosfile or just generally?
Inside the cosfile you don't need to at all. After making an object with the NEW: #### commands, it's automatically TARG. All following commands coming after that are executed by the NEW: agent, till you TARG something else.


Lets play plants! Photosynthesis... Photosynthesis... Photosynthesis...
 
Horstj

Horstj



  6/17/2011

Oops, this should have been in Development forum
ehm I was thinking of something like this:

ject "whatever.cos" 6
target the injected stuff
move to somewhere else

 
Papriko
Peppery One

Papriko



  6/18/2011

that's rather inefficient I think. Directly JECT it to the place you want it at.

As alternative you can call the position of the mouse with MOPX and MOPY. Just be careful that you don't spawn your stuff in a wall.

Another rather useful code is this:
seta va00 targ
enum 1 2 11
spas targ va00
doif ov00 = 0 and clac = 0
mesg writ targ 0
endi
It directly moves the created object into your inventory.

Credits for the Inventory Code go to AquaShee and his tutorial CAOS Chaos here on Creatures Caves.


Lets play plants! Photosynthesis... Photosynthesis... Photosynthesis...
 
Horstj

Horstj



  6/18/2011

that's rather inefficient I think. Directly JECT it to the place you want it at.


not possible. The cos-scrips are already existing and the mvto position can easyly change over time (so no hard code, sorry).
I think it can be done with enum and doif posx and posy. Would that move all of the agent there or qust one?
(im planig to be able to make multiple agents at once so i need to know weather mvto soluld be inside or outside reps).

 
Papriko
Peppery One

Papriko



  6/18/2011

I think it can be done with enum and doif posx and posy. Would that move all of the agent there or qust one?

ENUM goes through all agents with the matching classifier. The first is selected, then it does the code. Then the second is selected and does the code. Afterwards the third is selected and does the code and so on...



The cos-scrips are already existing

Are you going to make an own agent create existing objects? In this case it's better when you copy the injection script for the -I simply guess now- food object from the cosfile into your own agent. It is way easier than JECTing and playing with TARG to get it where you want.


Lets play plants! Photosynthesis... Photosynthesis... Photosynthesis...
 
Horstj

Horstj



  6/18/2011

Are you going to make an own agent create existing objects? In this case it's better when you copy the injection script for the -I simply guess now- food object from the cosfile into your own agent. It is way easier than JECTing and playing with TARG to get it where you want.


Thats a briliant idea! But its not food. BTW: can it cause problems to ject 2 a cosfile (injecting its scrips) thats scrips are already present? Do I get multiple scrips or are the old ones overwritten?

 
Papriko
Peppery One

Papriko



  6/18/2011

I think the new scripts simply overwrite the old scripts. To go totally sure I'd still suggest you to remove the stuff first.

But still, why are you using JECT in an agent? In my opinion it is more to repair broken default stuff or to add and remove scripts in development.


Lets play plants! Photosynthesis... Photosynthesis... Photosynthesis...
 
Horstj

Horstj



  6/18/2011

ject 2 is loading the scripts, so you can use it for updating an agent (in this case from version 0.1 to 0.2 (or similar)) without having to remove and recreate the stuff (wich you would have to do if you ject 1 first).
 
Papriko
Peppery One

Papriko



  6/19/2011

I simply do it all in one step with JECT 7. It removes objects + scripts and then recreates it all again in a single line.

Lets play plants! Photosynthesis... Photosynthesis... Photosynthesis...
 
Horstj

Horstj



  6/19/2011

But I do not want to remove the objects, because for updating an agent to the next version it woud be plain unsatisfiing, because everyone has to re do theire setups with the agents.
for repairing something ject 7 is surely better but for simply updating ject 2 should work quite fine.

 
Papriko
Peppery One

Papriko



  6/20/2011

I was talking about the development part.

In a finished agent you should avoid JECT completely. Only exceptions might be special backup systems for the world or something like that.


Lets play plants! Photosynthesis... Photosynthesis... Photosynthesis...
 
Horstj

Horstj



  6/20/2011


In a finished agent you should avoid JECT completely.


really? what could happen if I try to update it using ject 2?

 
Papriko
Peppery One

Papriko



  6/21/2011

Agent files self can not be JECTed either. You had to include the cosfile in the agent (or send a new cosfile for updates) and then place it by hand in the Bootstrap folder.

A huge disadvantage would be this: when the person with the cosfile creates a new world, the scripts from the cos are directly loaded in. Always. In every new world. If you want or not.

Next disadvantage: the scripts would be loaded as I said above. When you install now the actual agent to your world with the original file, then the old bugged scripts from that original file would overwrite the update cos. You had to JECT it another time by hand to re-update.

A third thing is this: I already mentioned that the cosfiles had to be placed by hand in the folders. People do not like that. They prefer it easy. Download the agent, install it, everything fine. Sometimes it can not be avoided to install extra files by hand, but in general you should do your best to get around that. The agent should work on it's own.

A last point to updates. The best is you do it like me and most other developers.
A) You try to make your agent so good that no updates are needed, or
B) after debugging your scripts, create a new agent with the other cosfile. Afterwards you give your agent a number, for example "Awesomeness Agent 1.0/1.1/1.2/..." or "Mega Agent 1.7". The number number after the 1. is the update counter.


Lets play plants! Photosynthesis... Photosynthesis... Photosynthesis...
 
Horstj

Horstj



  6/21/2011

It would work the following way:
- overwrite old .agent file, old sound, graphics and catalogue files.
- add special cos file (like the one in new agent file just without installpart)
- push the UPDATE button
(- now you can savely remove the special cos file (but it's not necessary))

 
Papriko
Peppery One

Papriko



  6/22/2011

You still have disadvantage 1 and 3.

Seriously, that stuff with the cosfile is a bad idea. Don't do it. Simply recompile the agent with the updated cosfile. It makes life easier for everyone.
That cosfile idea is creative and probably meant nice, but in the end actually not so great.
Your code becomes a lot more complicated. More possible conflicts, more stuff to mess up, longer file you must read through, error hunt takes longer, removing the errors once you found them takes longer too, the user will be annoyed of all the file mess it has to do even for minor changes in the agent.....

Please, Please, PLEASE do it the usual way!
It makes all just unnecessarily complicated. In the end you'll think "Argh, he was right! Why didn't I listen to him?".


Lets play plants! Photosynthesis... Photosynthesis... Photosynthesis...
 
Ghosthande
Prodigal Sock

Ghosthande


 visit Ghosthande's website: Breeders Beware
  6/22/2011

This sounds like a hassle to inject, Horstj. What exactly is this agent going to be, that it must be injected this way?

For reasons Papriko has already explained, asking people to put up with the relative hassle of .cos files is a big no-no for developers. There are few scenarios in which using a .cos file is better than using an agent, generally when the developer is attempting to patch a problem present in one of the game's native scripts.

Also bear in mind that old files will not automatically be overwritten when an agent unpackages new ones. This includes catalogue files, sounds and sprites. The old ones will remain as they are, the new ones will not be injected because the game recognizes there are already files with the same name installed, and you may have a big mess on your hands when your updated agent ends up using the old files instead of new ones.



 
Horstj

Horstj



  6/22/2011

With an OLD operating system it would be a single folder to paste in, but modern systems (like f***ing vista) put the files to diffrent direcorys (so you have to mess around with the files if you want to or not (catalogue files get placed in a folder where they don't get read)). And testing and stuff IS a huge mess: It is a metavendor captable of injecting serveral other agents (currently not many) using a smaaal amount of species numbers (2) getting them differentiated by OVs. There is already a prealpha aviable (here on CreaturesCaves (C3/DS - Misc - Multi-Vend X-1000)). Curently I'm working on an agent that will help me to make another.
At first I wanted to write far less than this...

 


downloads
cobs
adoptions
creaturelink
metarooms
breeds
 
gallery
art
wallpaper
screenshots
graphics
promos
sprites
dev
hack shack
script reservations
dev resources
active projects
dev forum
 
community
links
advice
chat
polls
resources
creatchi
 
forum
bookmarks
general
news
help
development
strangeo
survivor
mycaves
log in
register
lost pw
1 online
RisenAngel
creatures caves is your #1 resource for the creatures artificial life game series: creatures, creatures 2, creatures 3, docking station, and the upcoming creatures family.

contact    help    privacy policy    terms & conditions    rules    donate    wiki