1
mIRC/pawn Scripting / Location Script
« on: September 30, 2007, 03:40:39 pm »
Location script using hash table instead of ini file.
Create and load hash table
Set max locations
Get Players Locations
Convert old ini to hash
Hope this is useful for some of you guys.
Falcon
Create and load hash table
Code: [Select]
!hmake -s area 2000
if ($exists(vcmp.area.txt)) { !hload area vcmp.area.txt }
Set max locations
Code: [Select]
var %a = 1
while ($hget(area,%a) != $null) {
!inc %a
}
set %max_loc %a
Get Players Locations
Code: [Select]
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
Code: [Select]
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