• Welcome to Vice City Multiplayer.
 

Location Script for LC

Started by bakasan, November 28, 2007, 04:49:40 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bakasan

i haven't seen a location script for lc around, so i decided to have a go at making one and describe the process.  the one i made uses just basic zones, more could be defined later.

to create and save the hash table needed:
1) copy the data/info.zon file from your gtalc or lc-mp installation into your mirc dir
2) copy this alias into your mirc:

alias convertlocationsfrominfozontohash {
  var %infozonfile = info.zon, %i = 1, %c = 0
  if ($hget(infozontemp)) !hfree -s infozontemp
  !hmake -s infozontemp 500
  while (%i < $lines(%infozonfile)) {
    tokenize 32 $read(%infozonfile,%i)
    if ($7) {
      !inc %c
      !hadd infozontemp %c $+($3,$7,$6,$7,$6,$4,$3,$left($4,-1))
      !hadd infozontemp %c $+ . $left($1,-1)
    }
    !inc %i
  }
  !hadd infozontemp max_loc %c
  !hsave infozontemp lcmp.area.hash
  !hfree -s infozontemp
}

3) in your mirc, trigger the alias by typing: /convertlocationsfrominfozontohash

this creates a saved file called lcmp.area.hash which can be used with a location script like this:

create and load the hash table from the saved file when the script starts

!hmake -s area 500
if ($exists(lcmp.area.hash)) !hload area lcmp.area.hash


alias for getting a location name from x y coordinates e.g. $lcmp.area(%x,%y)

alias lcmp.area {   
  if (($1) && ($2)) {
    var %a = 1
    while (%a <= $hget(area,max_loc)) {
      var %t = $hget(area,%a)
      if ((%t) && ($inpoly($1,$2, [ %t ] ))) !return $hget(area,%a $+ .)
      !inc %a
    }
  }
  !return Liberty City
}


at first, the names may not be worded the way you want, but thats easy enough to change...

all of this will be included (plus heaps more) with my upcoming vcmp/lcmp mirc echo bot release ^^ but this is for those who wonder how it was done or dont want to wait