All pastes #285831 Raw Edit

Someone

public text v1 · immutable
#285831 ·published 2006-12-20 02:25 UTC
rendered paste body
; See how long since we last displayed a message, then do
; some subtraction to work out how long we have to wait
; to do it again
;   Do this after the sub's done

; VARIABLES
set %namedist 10            ; How close should a player be before you start nicknaming him?
set %delay 4000             ; How long to wait between nickname scans?


; BEGIN MAIN PROGRAM
  finditem HS_IS                   ; Inititialise nearby players
  for %x 0 #findcnt             ; for x = 1 to number of players...
  {
    finditem HS_IS %x              ; Find nearby player x
      if ( #finddist < %namedist ) && ( #charid <> #findid )
      {
        gosub giveName #findID
      }
  }
  
  ; Wait a bit if it's done too soon
   if ( #systime - %oldtime ) < %delay
   {
     set %towait ( %delay - ( #systime - %oldtime ) )  / 50 )
     wait %towait
   }
   set %oldtime #systime
   
   
; SUBROUTINES BELOW HERE

  sub giveName %1
    ; First, we'll generate a first name
    str mid %1 1 1               ; Get the first letter of the playerID
    ; BEGIN CASE STATEMENT
    goto case , #strres

    caseA:
      set %firstname Alan
       goto case_exit

    caseB:
      set %firstname Ben
       goto case_exit

    caseC:
      set %firstname Chris
       goto case_exit

    caseD:
      set %firstname Dave
       goto case_exit

    caseE:
      set %firstname Ed
       goto case_exit

    caseF:
      set %firstname Frank
       goto case_exit

    caseG:
      set %firstname Greg
       goto case_exit

    caseH:
      set %firstname Hal
       goto case_exit

    caseI:
      set %firstname Ian
       goto case_exit

    caseJ:
      set %firstname John
       goto case_exit

    caseK:
      set %firstname Karl
       goto case_exit

    caseL:
      set %firstname Liam
       goto case_exit

    caseM:
      set %firstname Mike
       goto case_exit

    caseN:
      set %firstname Nigel
       goto case_exit

    caseO:
      set %firstname Oscar
       goto case_exit

    caseP:
      set %firstname Paul
       goto case_exit

    caseQ:
      set %firstname Quentin
       goto case_exit

    caseR:
      set %firstname Rob
       goto case_exit

    caseS:
      set %firstname Steve
       goto case_exit

    caseT:
      set %firstname Tim
       goto case_exit

    caseU:
      set %firstname Ulric
       goto case_exit

    caseV:
      set %firstname Vince
       goto case_exit

    caseW:
      set %firstname Wayne
       goto case_exit

    caseX:
      set %firstname Xavier
       goto case_exit

    caseY:
      set %firstname Yoshi
       goto case_exit

    caseZ:
      set %firstname Zack
       goto case_exit

    case_exit:
    ; END CASE STATEMENT

      ; Now generate a surname
    str mid %1 2 1               ; Get the last letter of the playerID
    ; BEGIN Scase STATEMENT
    goto Scase , #strres

    ScaseA:
      set %surname Adams
       goto Scase_exit

    ScaseB:
      set %surname Barnes
       goto Scase_exit

    ScaseC:
      set %surname Crosby
       goto Scase_exit

    ScaseD:
      set %surname Duncan
       goto Scase_exit

    ScaseE:
      set %surname Evans
       goto Scase_exit

    ScaseF:
      set %surname Ford
       goto Scase_exit

    ScaseG:
      set %surname Godwin
       goto Scase_exit

    ScaseH:
      set %surname Hendry
       goto Scase_exit

    ScaseI:
      set %surname Ivorson
       goto Scase_exit

    ScaseJ:
      set %surname James
       goto Scase_exit

    ScaseK:
      set %surname Kelly
       goto Scase_exit

    ScaseL:
      set %surname Lord
       goto Scase_exit

    ScaseM:
      set %surname Morris
       goto Scase_exit

    ScaseN:
      set %surname Nicholls
       goto Scase_exit

    ScaseO:
      set %surname Oliver
       goto Scase_exit

    ScaseP:
      set %surname Peters
       goto Scase_exit

    ScaseQ:
      set %surname Brown
       goto Scase_exit

    ScaseR:
      set %surname Richards
       goto Scase_exit

    ScaseS:
      set %surname Smith
       goto Scase_exit

    ScaseT:
      set %surname Thatcher
       goto Scase_exit

    ScaseU:
      set %surname Underton
       goto Scase_exit

    ScaseV:
      set %surname Vader
       goto Scase_exit

    ScaseW:
      set %surname Wilson
       goto Scase_exit

    ScaseX:
      set %surname Jones
       goto Scase_exit

    ScaseY:
      set %surname Yates
       goto Scase_exit

    ScaseZ:
      set %surname Fletcher
       goto Scase_exit

    Scase_exit:
    ; END      case STATEMENT

    event ExMsg %1 3 153 -> %firstname %surname <-
  return ; end sub