Is there a way to make a list that contains movable atoms?
I made a new list under a specific object, and I wanted it to have a list called occupants that accounted for any movable atom that crosses it. After making the list I used the atom/O ref with
occupants[]
as such occupants.add(O)
and while it compiles, I get a runtime error after stepping onto the object associated with adding to the list
You can also use the Enter() and Entered() procedures to handle what is done to a mob that enters a tile.
|
Deathguard wrote:
You can also use the Enter() and Entered() procedures to handle what is done to a mob that enters a tile. Don't forget Cross() and Crossed() for pixel movement. Enter() isn't called until the bottom left corner goes into the tile. |
Raruno wrote:
Is there still a way to make a list of movable atoms? The same way you'd make a list of anything else. Lists don't restrict what can go in them. |
I get a runtime error when a movable atoms is added to a list.
so for some reason if I did this it wouldn't work: mob Note this is not my actual code but the idea I'm trying to implement |
Raruno wrote:
I get a runtime error when a movable atoms is added to a list. > mob Note this is not my actual code but the idea I'm trying to implement mob/var/list/entities = list() |
You have to initialize the list first. What you do with "var/L[]" is declare a variable and tell Dream Maker that the variable is a list. This is exactly the same as typing "var/list/L".
What you need is to initialize the list object. var L[0]
The number in the brackets determines the initial size of the list, filling it with nulls, but usually you're going to want to just make an empty one to start with. |
You can also check an atom's locs.
The above is assuming you are using pixel movement. If not, then it is even simpler. Just check the loc, because that's a list of things that are over it. Seeing as you are trying to use this list with an object, you just need to check the object's loc's contents for anything other than the object.