haxball / haxball-issues

115 stars 43 forks source link

Flag Change Haxball headless #1675

Open scar3333 opened 2 years ago

scar3333 commented 2 years ago

Hello everyone! Would you tell me how to change the flag in a haxball bot?

I'm using the haxbot_public.js and trying to configure it but there are things that I can't do.

/* VARIABLES */

/* ROOM */

const roomName = 'Public Room';
const maxPlayers = 12;
const roomPublic = true;
const token = ""; // Insert token here

var roomWebhook = ''; // this webhook is used to send the details of the room (chat, join, leave) ; it should be in a private discord channel
var gameWebhook = ''; // this webhook is used to send the summary of the games ; it should be in a public discord channel
var fetchRecordingVariable = true;
var timeLimit = 3;
var scoreLimit = 3;

var gameConfig = {
    roomName: roomName,
    maxPlayers: maxPlayers,
    public: roomPublic,
    noPlayer: true,
}

if (typeof token == 'string' && token.length == 39) {
    gameConfig.token = token;
}

var room = **HBInit(gameConfig);

I tried the following worse it did not work:

var room = HBInit({ roomName: "room name", public:true, maxPlayers: 12, geo : { code: 'af', lon: 69.160652, lat: 34.543896 } });

since now, thanks

09x2019 commented 2 years ago

Hello everyone! Would you tell me how to change the flag in a haxball bot?

I'm using the haxbot_public.js and trying to configure it but there are things that I can't do.

/* VARIABLES */

/* ROOM */

const roomName = 'Public Room';
const maxPlayers = 12;
const roomPublic = true;
const token = ""; // Insert token here

var roomWebhook = ''; // this webhook is used to send the details of the room (chat, join, leave) ; it should be in a private discord channel
var gameWebhook = ''; // this webhook is used to send the summary of the games ; it should be in a public discord channel
var fetchRecordingVariable = true;
var timeLimit = 3;
var scoreLimit = 3;

var gameConfig = {
    roomName: roomName,
    maxPlayers: maxPlayers,
    public: roomPublic,
    noPlayer: true,
}

if (typeof token == 'string' && token.length == 39) {
    gameConfig.token = token;
}

var room = **HBInit(gameConfig);

I tried the following worse it did not work:

var room = HBInit({ roomName: "room name", public:true, maxPlayers: 12, geo : { code: 'af', lon: 69.160652, lat: 34.543896 } });

since now, thanks

You can use the following the code:

var room = HBInit({ roomName: "My room", maxPlayers: 16, geo: { "code": "USA", "lat": 34.543896, "lon": 69.160652 }, public: true, noPlayer: true // Remove host player (recommended!) });

It will be enough to write the country code in the "code" section.