Location script using hash table instead of ini file.
Create and load hash table
!hmake -s area 2000
if ($exists(vcmp.area.txt)) { !hload area vcmp.area.txt }
Set max locations
var %a = 1
while ($hget(area,%a) != $null) {
!inc %a
}
set %max_loc %a
Get Players Locations
alias vcmp.area {
var %a = 1,%b = $hget(vcmp,pos.x. $+ $1),%c = $hget(vcmp,pos.y. $+ $1),%d
while (%a < %max_loc) {
%d = $hget(area,%a)
if ($inpoly(%b,%c, [ %d ] )) !return $hget(area,%a $+ .)
!inc %a
}
Convert old ini to hash
alias convert {
!hmake -s area 2000
var %a,%b = 1,%c
%a = AREA2
while (%b <= $ini(vcmp.data.ini,%a,0)) {
%c = $ini(vcmp.data.ini,%a,%b)
!hadd area %b %c
!hadd area %b $+ . $readini(vcmp.data.ini,%a,%c)
!inc %b
}
!hsave area vcmp.area.txt
}
Hope this is useful for some of you guys.
Falcon