ID:2782262
 
(See the best response by Lummox JR.)
Problem description:

Hi, I would like to keep track of a player`s interaction with NPCs for things such as timely (daily) quests.
So I thought of the player having an array keeping track of a tuple [(npc, time)].
Is there anyway to do something like this? I tried even a multidimensional array but got invalid expression.

For now, the simples solution I thought was mapping 2 same-sized arrays
Code:
npc_interactions[] = new /list(0)
npc_time_interactions[] = new /list(0)


But it could go south really fast.

I also accept solutions to keep track of these kind of data. My experience with these kind of situations would be to use a DB to track ids and such, but I don`t know how it would go on DM.
For simple purposes, you can use lists as dictionaries. In the docs, it's under list associations. With that, you can have a list where each NPC is associated with their time.

Warning though, try not to save NPCs with the player. Loading a player from a savefile would result in instantiating another copy of the NPC, which is probably not good. Better to go with an ID as some value type if you intend to save this list.

For more complex situations, you could just use a datum (a type with minimum inherited types) to represent your interactions, and have a simple list of those (or a dictionary of IDs associated to them). If there's any procs specific to these interactions, they can go in this type too.
npc_interaction
var/id
var/time
// etc.

Maybe worth mentioning is that DM uses SQLite for its /database object, if you're interested in databases.
Best response
An associative list is probably the best bet. Let's say each of your NPCs has a unique tag var. Then you can keep track of interaction times that way:

mob
var/list/npc_time // tag = time pairs

proc/RecordInteraction(mob/npc)
if(!npc_time) npc_time = new // create the list if needed
npc_time[npc.tag] = world.realtime

proc/LastInteraction(mob/npc)
return npc_time?[npc.tag] || 0

The ?[] operator above means the result of npc_time?[npc.tag] will be null if the list hasn't been created yet. If there's been no interaction recorded, again you'll get a null. The || 0 part forces the proc to return a number instead of null.

If you want more complex data than just storing a time, a datum approach like Kaiochao suggested is probably best. In that case however I'd still use an associative list where the items in the list are the NPCs' tags, and the associated values would be datums with all the interaction info. That could include data like whether they gave certain quest info out, how much they like/dislike the player, etc.

It should be fairly straightforward to switch to a datum system later on if you start with just recording times.