Author Topic: The HCL Standard (map devs read this)  (Read 3976 times)


  • Administrator
  • Hero Member
  • *****
  • Posts: 566
  • Karma: +86/-12
    • View Profile
The HCL Standard (map devs read this)
« on: December 14, 2013, 07:11:07 pm »
Original post by summer/Varlock

This thread is now about the HCL system as developed and explained in the posts below this one. It is used for passing a very limited amount of data from the bot to the map by encoding information in player handicaps. The intention is that it will be used to set game modes and other game settings when you want the bot to specify them rather than the players. Please read this thread for more information, including some example JASS code you can include in your map to use the HCL system.

Quick link to the JASS code:

Library mirror, just in case:
Code: [Select]
/// HostBot Command Library
/// Last Modified: September 14, 2009
/// Authors: Strilanc,
/// v1.01
/// Reads a command string transparently encoded into player handicaps by hostbots.
/// Allows at most one character from "abcdefghijklmnopqrstuvwxyz0123456789 -=,." per player.
/// Empty slots don't count towards the player count, but computers do.
library HCL initializer init
        private string command = ""
    public function GetCommandString takes nothing returns string
        return command
    private function init takes nothing returns nothing
        local integer i
        local integer j
        local integer h
        local integer v
        local string chars = "abcdefghijklmnopqrstuvwxyz0123456789 -=,."
        local integer array map
        local boolean array blocked

        //precompute mapping [have to avoid invalid and normal handicaps]
        set blocked[0] = true
        set blocked[50] = true
        set blocked[60] = true
        set blocked[70] = true
        set blocked[80] = true
        set blocked[90] = true
        set blocked[100] = true
        set i = 0
        set j = 0
            if blocked[j] then
                set j = j + 1
            exitwhen j >= 256
            set map[j] = i
            set i = i + 1
            set j = j + 1
        //Extract command string from player handicaps
        set i = 0
            exitwhen i >= 12
            set h = R2I(100*GetPlayerHandicap(Player(i)) + 0.5)
            if not blocked[h] then
                set h = map[h]
                set v = h/6
                set h = h-v*6
                call SetPlayerHandicap(Player(i), 0.5 + h/10.0)
                set command = command + SubString(chars, v, v+1)
            set i = i + 1
« Last Edit: December 14, 2013, 08:20:51 pm by uakf.b »