Author Topic: UniChat!  (Read 6436 times)

0 Members and 1 Guest are viewing this topic.

Offline _iPhoenix_

  • Super User
  • Join Date: Mar 2017
  • Location:
  • Posts: 593
  • Post Rating Ratio: +12/-1
  • █████ ▼ ♪ Best music ♫
    • @dj_iPhoenix
    • @UCytgMNPxAMDsxjimvxHf01w
    • Legend-of-iPhoenix
    • @the-legend-of-iphoenix
    • About me.
  • Gender: Male
Re: UniChat!
« Reply #30 on: December 28, 2017, 01:05:10 am »
I'm having some issues with my own code that I cannot solve. (And to think I'm the person who is supposed to know these things...)

In the bots API, (relevant file, main.js, is here) I'm having some issues where multiple objects (in this case, bots) of the same constructor are sharing properties. (in this case, the name attribute)

In my code, I am creating and initializing bots as per my documentation, but I am initializing two bots, one with the name "iPhoenixBot", and the other with the name "karmaBot". Note that iPhoenixBot is being initialized first, then karmaBot.

The command "~bad" is registered under iPhoenixBot, yet when I execute that command, this happens:

[07:47:52] _iPhoenix_: ~bad
[07:47:53] [karmaBot]: That's so bad, it's almost impressive!
As you can tell, the username is showing up wrong.

The console tells me this:

Callback for bot "iPhoenixBot" triggered with message "bad".
Response from "karmaBot" received. //this should be "iPhoenixBot", not "karmaBot"
Callback for bot "karmaBot" triggered with message "bad".

In the main.js file linked above, I am using the bot_name input from the constructor in the code to determine what name to display.

I initially assumed this was the problem. I thought that the bot_name variable might be changed each time the constructor is called, even though this seems strange.

I changed it to "", which is the bot's name. This works elsewhere, but it didn't work there.

How can I fix this, and what exactly is happening?

I fixed it, but I can't quite explain how I fixed it or how my fix works, but it does.
« Last Edit: December 28, 2017, 01:35:56 am by _iPhoenix_ »
  • Calculators owned: A sentient TI-84+ CE, TI-85
  • Consoles, mobile devices and vintage computers owned: TI-99/4a home computer
Please spam here:

"walruses are better than tuxedo chickens, all hail the great :walrii:" ~ me


You can also use the following HTML or bulletin board code to share it on your page or forum signature!

Also do not forget to check our affiliates below.
Planet Casio TI-Planet BroniesQC BosaikNet Velocity Games