if maps of monsters contains monster not working

tyilo

Member
Code:
monster [int] names;
names[0] = $monster[monster1];
names[1] = $monster[monster2];
...
if(names contains last_monster())
This doesn't work (ofc replace monster1 and monster2 with real monster names and replace ... with some code adventuring) and i get this error:
Cannot apply operator contains to names (monster [int]) and last_monster() (monster)
Why?
 
Last edited:

matt.chugg

Moderator
I believe "contains" looks at the key as opposed to the value, however I could be entirly wrong!

Code:
boolean [monster] monsters;


monsters[$monster[1335 HaXx0r]]=true;
monsters[$monster[7-Foot Dwarf]]=true;
monsters[$monster[7-Foot Dwarf Foreman]]=true;
monsters[$monster[A.M.C. gremlin]]=true;

print(monsters contains $monster[A.M.C. gremlin]);
print(monsters contains $monster[acid blob]);
 
Top