haxball / haxball-issues

116 stars 43 forks source link

Prediction game #1610

Closed byoxygen closed 2 years ago

byoxygen commented 2 years ago

Hi guys,

I want earn XP points predicting a match result. Can someone help me with this?

thenorthstar commented 2 years ago

Hi guys,

I want earn XP points predicting a match result. Can someone help me with this?

@byoxygen Here's simple XP system on the following link: https://github.com/thenorthstar/HaxBall-Example-Scripts/blob/main/Beginner/XPSystem_v1.js

I wish it would be helpful for you.

Edit: I have found another script with betting system, on GitHub. You can also try it through the script on the following link: https://github.com/Elinous-Electra/another-haxball-bot-script/blob/master/index.js

byoxygen commented 2 years ago

@thenorthstar I appreciate your help so much. How to keep names and xp in local?

I also got the following errors when I try to voting.

at Array.chat_bet (<anonymous>:317:43)
at room.onPlayerChat (<anonymous>:513:48)
thenorthstar commented 2 years ago

@thenorthstar I appreciate your help so much. How to keep names and xp in local?

I also got the following errors when I try to voting.

at Array.chat_bet (<anonymous>:317:43)
at room.onPlayerChat (<anonymous>:513:48)

@byoxygen How did you get this error then? Interestingly I haven't gotten such an error even though creating this code step by step.

Edit: Code updated and a null control added, try again please?

byoxygen commented 2 years ago

@thenorthstar It's solved, thanks. How to we keep names and xp in local?

thenorthstar commented 2 years ago

@thenorthstar It's solved, thanks. How to we keep names and xp in local?

@byoxygen Data transfer with the localStorage is as follows:

Set: localStorage.setItem("playerList",JSON.stringify(playerList)) Get: JSON.parse(localStorage.getItem("playerList"))

But don't worry I have done it myself for you for the last time. Further ones will be homework for you anymore. Here's the code: https://github.com/thenorthstar/HaxBall-Example-Scripts/blob/main/Beginner/XPSystem_v2.js

qoksel00 commented 2 years ago

@thenorthstar It's solved, thanks. How to we keep names and xp in local?

@byoxygen Data transfer with the localStorage is as follows:

Set: localStorage.setItem("playerList",JSON.stringify(playerList)) Get: JSON.parse(localStorage.getItem("playerList"))

But don't worry I have done it myself for you for the last time. Further ones will be homework for you anymore. Here's the code: https://github.com/thenorthstar/HaxBall-Example-Scripts/blob/main/Beginner/XPSystem_v2.js resim_2022-04-05_152521 Bu Hatayı alıyoruz @thenorthstar

thenorthstar commented 2 years ago

@thenorthstar It's solved, thanks. How to we keep names and xp in local?

@byoxygen Data transfer with the localStorage is as follows: Set: localStorage.setItem("playerList",JSON.stringify(playerList)) Get: JSON.parse(localStorage.getItem("playerList")) But don't worry I have done it myself for you for the last time. Further ones will be homework for you anymore. Here's the code: https://github.com/thenorthstar/HaxBall-Example-Scripts/blob/main/Beginner/XPSystem_v2.js resim_2022-04-05_152521 Bu Hatayı alıyoruz @thenorthstar

@qoksel00 Ben öyle bir hata almıyorum?

byoxygen commented 2 years ago

@thenorthstar, can you add xp transfer feature between players? In addition, usage may be restrained for under 0 xp players.

thenorthstar commented 2 years ago

@thenorthstar, can you add xp transfer feature between players? In addition, usage may be restrained for under 0 xp players.

@byoxygen It has been updated on the following code: https://github.com/thenorthstar/HaxBall-Example-Scripts/blob/main/Beginner/XPSystem_v2.js

byoxygen commented 2 years ago

@thenorthstar Hi,

I got the following errors when I try to send xp. Sometimes, i am getting won is not appearing on stats command.

 at Array.chat_xpSending (<anonymous>:494:91)
 at room.onPlayerChat (<anonymous>:638:48)
qoksel00 commented 2 years ago

I got the following errors when I try to send xp. Sometimes, i am getting won is not appearing on stats command.

Merhaba @thenorthstar ben bu kodları rs botuna eklemeye çalısıyorum bu hatayı alıyorum 161754370-64a50110-9060-4579-abbb-efe20427d093

thenorthstar commented 2 years ago

@thenorthstar Hi,

I got the following errors when I try to send xp. Sometimes, i am getting won is not appearing on stats command.

 at Array.chat_xpSending (<anonymous>:494:91)
 at room.onPlayerChat (<anonymous>:638:48)

@byoxygen I have updated the code, it's working now.

Sending: image

Getting: image

I got the following errors when I try to send xp. Sometimes, i am getting won is not appearing on stats command.

Merhaba @thenorthstar ben bu kodları rs botuna eklemeye çalısıyorum bu hatayı alıyorum 161754370-64a50110-9060-4579-abbb-efe20427d093

@qoksel00 Bir yerleri değiştirmiş ya da bozmuş olabilirsin. Bir diğer ihtimal localStorage'ı temizlemiş olabilirsin. Bunları kontrol et, sonra konuşalım tekrar.

qoksel00 commented 2 years ago

@thenorthstar Hi, I got the following errors when I try to send xp. Sometimes, i am getting won is not appearing on stats command.

 at Array.chat_xpSending (<anonymous>:494:91)
 at room.onPlayerChat (<anonymous>:638:48)

@byoxygen I have updated the code, it's working now.

Sending: image

Getting: image

I got the following errors when I try to send xp. Sometimes, i am getting won is not appearing on stats command.

Merhaba @thenorthstar ben bu kodları rs botuna eklemeye çalısıyorum bu hatayı alıyorum 161754370-64a50110-9060-4579-abbb-efe20427d093

@qoksel00 Bir yerleri değiştirmiş ya da bozmuş olabilirsin. Bir diğer ihtimal localStorage'ı temizlemiş olabilirsin. Bunları kontrol et, sonra konuşalım tekrar.

merhaba en baştan ekledım sizin için biryerde hatamı yaptım diye öncelikle ilk eklediğimde aynı bu hatayı alıyorum 161754370-64a50110-9060-4579-abbb-efe20427d093

daha sonra specte boş duran botu yani noplayer kısmını botu specten kaldırınca hata buna dönüşüyor resim_2022-04-06_144242

byoxygen commented 2 years ago

@thenorthstar I am grateful for your forbearance as you've worked through the issue.

thenorthstar commented 2 years ago

@thenorthstar Hi, I got the following errors when I try to send xp. Sometimes, i am getting won is not appearing on stats command.

 at Array.chat_xpSending (<anonymous>:494:91)
 at room.onPlayerChat (<anonymous>:638:48)

@byoxygen I have updated the code, it's working now. Sending: image Getting: image

I got the following errors when I try to send xp. Sometimes, i am getting won is not appearing on stats command.

Merhaba @thenorthstar ben bu kodları rs botuna eklemeye çalısıyorum bu hatayı alıyorum 161754370-64a50110-9060-4579-abbb-efe20427d093

@qoksel00 Bir yerleri değiştirmiş ya da bozmuş olabilirsin. Bir diğer ihtimal localStorage'ı temizlemiş olabilirsin. Bunları kontrol et, sonra konuşalım tekrar.

merhaba en baştan ekledım sizin için biryerde hatamı yaptım diye öncelikle ilk eklediğimde aynı bu hatayı alıyorum 161754370-64a50110-9060-4579-abbb-efe20427d093

daha sonra specte boş duran botu yani noplayer kısmını botu specten kaldırınca hata buna dönüşüyor resim_2022-04-06_144242

@qoksel00 Resimlerden hataları nerelerde aldığını anlayabiliyorum. O konuda sorun yok da ilk attığın hatayı ben hiçbir şekilde almadım. Çok büyük ihtimalle sen noPlayer: true olayını kullanmadığın için alıyorsun o hatayı. İkinci hatayı neden aldığını ise henüz çözemedim ama ilki için iki çözüm var:

var isRoomSet = false;

room.onRoomLink = function(url){
    if(isRoomSet == false){
        playerList["Host"] = { name: "Host", id: 0, auth: "Auth, conn: "Conn", xp: 0, xpMultiplier: 1, bet: { red: 0, blue: 0 }, hasBet: false, canSendXP: true }; //Auth ve Conn yazılı yerlere odayı kuran kişinin bilgileri geliyor. Name yerine de oda kurulduğunda gelen botun adı gelecek.
        isRoomSet = true;
    }
}

@thenorthstar I am grateful for your forbearance as you've worked through the issue.

@byoxygen You're welcome. It's a pleasure for me.👍

byoxygen commented 2 years ago

@thenorthstar Hi again, Ive managed to put elsewhere without showing error code but xp values don't changing even using console. I always get session is unavailable message with multiple players.

thenorthstar commented 2 years ago

@thenorthstar Hi again, Ive managed to put elsewhere without showing error code but xp values don't changing even using console. I always get session is unavailable message with multiple players.

@byoxygen Make sure if roomObject.xpSessionFeatureActive is set to true and check the player amount in both for the red and blue teams. At least one player must be in both of the red and blue teams.