How do I force-control the bot?

After I did the dance with controlChar/wakeup I have the ctrl to interact as the bot. However, if the connection breaks, or the app crashes, or whatever, the new attempt to take control of the bot fails with core.charAlreadyControlled. @Accipiter how do I “decontrol” the bot if the previous connection is dead?

1 Like

The control of a character is completely detached from connections. This mean (for good and bad) that:

  • Getting disconnected will have no affect on state
  • Reconnecting will have no affect on state
  • Having two connections simultaneously sending commands will also be totally okay (Yay! Chaos! But… for bot connections, this might need to change in the future to only allow a single connection to have control)

To release control, you have two options:

  1. Don’t send a char ping from any connection for 1 hour. The server will then automatically put the character asleep and release control.
  2. Call the release method: call.core.char.$charId.ctrl.release

So, what to do if your script is restarted? At script start, check if your character already is controlled, and skip the ‘controlChar’ step if that is the case. Same goes with ‘wakeup’.

(Below example is untested, and it assumed you have already authenticated)

// Get bot model
client.call('core', 'getBot')
   // If bot.controlled is set, it contains our already controlled character.
   // Otherwise we call 'contolChar' first.
   // Note: 'controlChar' also returns the same model that you will find in bot.controlled
   .then(bot => bot.controlled || bot.call('controlChar'))
   // If the state is not 'awake' , we call 'wakeup'.
   // In this example, I pass on the char to the next "then"
   .then(char => char.state != 'awake'
      ? char.call('wakeup').then(() => char)
      : char
   )
   // By now we have a controlled & awake char!
   .then(char => char.call('say', { msg: "I'm awake!" }));
1 Like

Ah derp, you’re right. I should have dumped the model to see if it was there.

On other hand, my bank is so realistic it takes the transaction fees now!

image

Which are diligently recorded in a honest-to-gob blockchain that runs on localhost:

Who gets the fees? Idk!

1 Like

Oh dear…

B-block chain banker?
For the fun of it…? Yes. For practical purposes? Oh dear, no! :sweat_smile:

A friend of mine working for some crypto company tried to pursuade me to consider NFTs for this game. I smiled and nodded (“Well, who knows…”) - but in my head it went; Never going to happen!

Edit. But “for the fun of it” is a very good reason in my opinon!

1 Like

it’s fun and slightly insane. I tried to figure this ethereum bs yesterday and it’s an extremely dumb and slow way to do things.

But hey, it’s entertaining! in a way. The blockchain alone ate up 1gb ram on the server so we’ll see. If the banker needs too much resources I’ll have to ditch it. For mongo. Lol.

1 Like

And just to be clear: this is never going to use any public blockchain so no trading for real money. and I own 2 gigazillion coins either way (I think the supply is actually limited so that’s all the chain will ever have?)

1 Like

Can we have Non-Fungible Talonstrikes on that blockchain? At least one?

1 Like

Wow, that was quick. I think I might need to add in a new feature to mine tonight.

Woot competition! Remember, the dragons running the SCAM support all kinds of financial services: public accounts, private accounts, hard untraceable cash, audits. They will collect interest and provide you with benefits if you use your Maximally Universal Coin Key card to pay for coffee at Miranda’s.

But yeah, you get a lot for free once the blockchain is running because that inherently provides more context than just a balance sheet. Making transaction history was trivial because you just iterate over the blocks and see if there are any related transactions. You can make a smart contract that stores the name to wallet id mapping and then you have the names stored right there in the blockchain for the transaction history purposes. And because the character id is stable you can use it to derive the private key instead of storing the key material, so you don’t even have to hold all the keys (the dragons do hold all the keys. All the SCAM belongs to dragons).

1 Like

Yeah, Far is a code speedster for sure!

But I take it Far is more trying it out for his own curiosity and for the challenge. After all - using block chain for something like this is truly a definition of ‘overengineering’ - the fun kind :grin:! Though, I will assume it will not become a “battle of currency” for Wolfery. Right, @farcaller ?

1 Like

:eyes:

Naw, I’m just doing this for fun of it to see if there is any practical application of blockchains. As long as the blockchain infra is under 8gb ram I don’t care if it exists or not.

I promised @Shinyuu that I’d take a look at the bots and update them according to the new spec, so this is a bit of a stepping stone of my going through the bot api to figure what are the changes required, too. Looks like it all is trivially convertible and the res_client requires no changes.

I don’t know why’d wolfery need a currency to begin with, but if there’s a currency there can be two currencies. There can be an FX rate. You can trade one things for other things and generally make no value out. Heck, with the blockchains you can actually create money by minting it and so you can pretty much drive an economy in the miniature. But it’s all futile as you don’t have to spend anything on anything in practice - unlike EVE online where the players drive the economy by necessity, there’s no such need over here. I just hope that I can get a dozen people on it to see some activity in the chain and poke a stick at it. I’m totally open to running any kind of smart contract on it as well for anyone else to have fun. It took me a whole day to figure how to set up the infra and it’s no fun in practice, so I’d rather save others the time.

1 Like

True, the changes are rather trivial.
And you can also get rid of any handling of those pesky common.tooActive errors, as bot connections will instead just delay the response.

I don’t mind multiple currencies though. And while I might rather like the free style of pretending, I know there are those who likes the idea of currencies. And if someone likes currencies, I can totally see how different areas with different themes may want to have different currencies. If people fancy that - who am I to say no?

But from what I’ve heard, I may already be able to use my Sinder Bucks to get myself some entertainment in the club that opened near by cabin!

Mmm… I just wonder how I can now set up my (imaginary) mining rig to mine new SCAMs!

1 Like

Mmm… I just wonder how I can now set up my (imaginary) mining rig to mine new SCAMs!

It doesn’t need to be imaginary - I use the proof of authority as the signing mechanism which basically means you don’t spend wasteful cpu cycles to generate new money, the existing authority just needs to recognize you. So it’s simple to start creating SCAM! Join the dragon-led revolution and hoard your digital assets! /s

1 Like

It’s more a flockchain.

2 Likes