ID:168265
 
Is there a way to define a new atom such as /obj or /turf? It'd be helpful if I could, because I want some things that I'm storing as objects not to appear when you use verbs, like GM-Edit or GM-Eradicate. I have a Suggestion Log, and I store each suggestion as an object so I can record via variables who supports or dislikes each submitted suggestion (and their IPs. No double votiing :( ), and also I made it so players can warp around by using certain objects whose layer value is "1" so that it doesn't show up, but I don't want GMs to be able to delete those with the same verb as normal things.

I realize I could just add something like this:

var/list/objsinworld = list()
for(var/obj/X in world) if(X.type != /obj/suggestion) objsinworld += X


but that would take much longer as there are a lot of GM verbs and I make more for myself every week :P

I looked in DM Referance, but all it says is that "its not recommended to define a new /atom/movable" and just to use /turf, /obj, /mob, and /area, so I figured it was possible but I can't get it :(

I currently have /atom/movable/returnpoint defined, but I can't place it on the map with Dream Maker, and when placed on the map while the game is hosting, it gives it the correct variables, but I can use all of the save verbs on it that I can use for an /obj. It doesn't have variables from /obj/var, its type isn't /obj/var, but it treats it as an obj :(

Is this just because the game doesn't like my new atom, because the game doesn't like me, or because doing what I'm trying to do is impossible? :P

(A quick Ctrl+H can change everything back to an obj, I'd just like this to work =)
Instead of using objects to store data, why not use datums? It's what they're there for. :)
In response to Jon88 (#1)
because I don't know what that is, and now you made me feel bad :( fine I'll go look it up.

EDIT: Helpppp reading didn't work now my head hurts :(
In response to Cowdude (#2)
Datums, and Gurus correct me if I'm wrong, are more like non-physical objects. They are good for grouping data, procs, and verb.

Here's an example:
Say you had a monster type /mob/monster
then you could do:
MonsterGroup //defaults to datum. don't need to right it.
var/list/monsters
var/gold
var/obj/items/list/treasure
proc
StartCombat(mob/player/P)
EndCombat(mob/player/P)


I hope this helps
In response to Dark Weasel (#3)
Well I'd need to match up a text value to a "locate" value, which wouldn't really work unless I can create multiples of a /datum/returnpoint; but it looks kinda like they're the same as areas :( I supposed I could do this though:

Returnpoints
list/names = list("Point 1", "Point 2")
list/locs = list(locate(1,1,1),locate(10,20,1))
/*Assuming I can store locs in a list; I've never
tried it though. I could always make an "X", "Y"
and "Z" list though x_x */


But then I'd need a way to access the lists. How would I do this? Meaning how would I make a verb to have the player pick from the name and match it to the corresponding location in the second list?
In response to Cowdude (#4)
Eh...scratch that. I was just trying to explain datums.

I don't think you should try making a new movable atom.
Just use obj. That's my advice. If you don't like it, you don't have to use it.
In response to Dark Weasel (#5)
But all you explained is what it was, not how to use it :( I just needed to know how to access the variables in the datum; do I use for(datum/returnpoint in world) or datum.returnpoint.variable or what? =(
In response to Cowdude (#4)
If the returnpoint is going to be on the map, you have to use an atomic object, since only those are able to be put on the map.

~~> Unknown person
In response to Cowdude (#6)
You'd need a list to hold the datums. When you create a returnpoint datum, add it to that list. Then you can loop through that list with for.
In response to Unknown Person (#7)
well it doesn't have to be on the map; I could do it like I said in the last post I used DM tags for. I just wanna know how to access a datum's variables :(
In response to Jon88 (#8)
So can I have more than once instance of a Returnpoint datum? It annoyed me messing with /area when all instances were the same :( but can I do this with datums?
In response to Cowdude (#10)
Cowdude wrote:
So can I have more than once instance of a Returnpoint datum? It annoyed me messing with /area when all instances were the same :( but can I do this with datums?

Each new datum is really a new datum. Also, in response to another question in this thread, you can store locations(turfs, usually) in a list. The only thing is you have to keep track of any newly created/deleted turfs, which could cause null references in the list, or in any other variable storing the old turf.
In response to Jon88 (#11)
What the hell are datums? And what are they used for... I really havent used them, so I'm lost.
In response to Lou (#12)
Lou wrote:
What the hell are datums? And what are they used for... I really havent used them, so I'm lost.

A datum is an object that doesn't go on the map.
In response to Jon88 (#13)
Processing...so if they don't go on the map...they are used how?
In response to Lou (#14)
Lou wrote:
Processing...so if they don't go on the map...they are used how?

For abstract information. You can use it to keep track of teams, stats, weather patterns or whatever have you. You can group many variables and functions together under that single abstract idea.
In response to Loduwijk (#15)
If I have two lists like before, one containing ("Point 1","Point 2","Point 3") and the other containing (locate(1,1,1), locate(5,21,1), locate(102,177,2)) and I have this line:

<dm>
var/X = input("Warp where?") in List1 // The list with the "Points"
</td>

How do I match up each point to the coordinates, assuming "Point 1" goes with locate(1,1,1), etc?
In response to Cowdude (#16)
It'd be easier to use an associative list for this, since all you might need to store is the point name and set it to a location.

var/list/points = list("point 1"=list(1,1,1),"point 2"=list(1,1,2)) // etc...


And to access it, you use the square brackets.

mob/verb
teleport_to()
var/i = input(src, "Where would you like to go?","Teleport") as null|anything in points
if(!i) return
var/j = points[i]
src.loc = locate(j[1],j[2],j[3])


~~> Unknown Person
In response to Unknown Person (#17)
I didn't know you could interchange "list[num]" and "list[object]" =) oh well

Can you not have this or something?:

var/list/points = list("point 1"=locate(1,1,1),"point 2"=locate(1,1,2)) // etc...


or are you just being fancy with your list of lists?
In response to Cowdude (#18)
You need to realise that locate() returns a turf, so if the turf got deleted in any way, the association would turn null. I did that so I could store the coordinates in a list, instead of a reference to an object.

~~> Unknown Person