My script suddenly stopped working

gumpy13x

New member
I've been using this script for a long time and now all of a sudden it doesn't work anymore. It displays 'Now pledging your allegiance to Bonus Adventures from Hell.' over and over again (the script does put me in that clan so I know it's not failing to do that) and I know the problem is on my end because doing the fortune teller manually works fine. Does anyone have any idea why it isn't working anymore?
 

Attachments

  • FortuneTeller.ash
    1.2 KB · Views: 6

fronobulax

Developer
Staff member
No, I don't know why. But knowing all sorts of changes I have made that shouldn't break anything, it would help to know if there is a version number when it did work and one when it didn't.

That might let me breathe easier.

I also recall some problems with the faxbot network that happened because the faxbot got stuck in a clan while fetching a fax and scripts that expected it in its home clan failed.

The 'Now pledging your allegiance' message doesn't seem to be coming from mafia but it is not clear what doesn't recognize you have successfully changed clans...
 

gumpy13x

New member
No, I don't know why. But knowing all sorts of changes I have made that shouldn't break anything, it would help to know if there is a version number when it did work and one when it didn't.

That might let me breathe easier.

I also recall some problems with the faxbot network that happened because the faxbot got stuck in a clan while fetching a fax and scripts that expected it in its home clan failed.

The 'Now pledging your allegiance' message doesn't seem to be coming from mafia but it is not clear what doesn't recognize you have successfully changed clans...
Sorry, I don't know what version it was that made it stop working. I've updated mafia since then to see if it would fix the problem but no luck.
 

lostcalpolydude

Developer
Staff member
Code:
while(get_clan_id() != 90485)
A first step would be to have the script print what it thinks get_clan_id() is in that block. And if something weird is happening with that, then there's also get_clan_name() to try.
 

MCroft

Developer
Staff member
It's the right clan ID, and the 'Now Pledging your allegiance' message is what you get when you /whitelist a clan, so that seems right.

Code-wise, I'd rather try it, check afterwards, and fail with a big ol' error.

It would probably fail exactly the same way, but something like this wouldn't loop forever.

Rich (BB code):
cli_execute("/whitelist bonus adventures from hell");

if (get_clan_id() != 90485)
    {
    print("Hey!  You didn't join the clan!  What's up with that?");
    print(get_clan_id());
    print(get_clan_name());
    exit;
    }
 
Last edited:

gumpy13x

New member
Code:
while(get_clan_id() != 90485)
A first step would be to have the script print what it thinks get_clan_id() is in that block. And if something weird is happening with that, then there's also get_clan_name() to try.
So apparently the script thinks get_clan_id() is 0.

Changing the script to use the clan name to identify which clan I'm in rather than the clan ID makes it work again.
 

fronobulax

Developer
Staff member
This sounded like something my JSON change might have broken. I don't think it did. But with the usual caveats I do wonder if there is something on KoL's end we are not getting or expecting.

AFAIK get_clan_id() ultimately gets its data from showplayer.php

Now when I try and look at showplayer.php in a browser I get

Sorry, this player could not be found.

pretty much no matter what parameters I do, or do not append as parameters.

Would someone else consider exploring and confirming the lack of showplayer response or tell me what I would have figured out if I had only spent five more minutes?

Thanks.
 

heeheehee

Developer
Staff member
Would someone else consider exploring and confirming the lack of showplayer response or tell me what I would have figured out if I had only spent five more minutes?
?who=354981 (or your player id of choice) works for me.

My next question: what does Mafia think your player ID is? Or rather... what does `get_player_id(my_name())` return? (as an approximation of what get_clan_id() does under the hood)
 

fronobulax

Developer
Staff member
?who=354981 (or your player id of choice) works for me.

My next question: what does Mafia think your player ID is? Or rather... what does `get_player_id(my_name())` return? (as an approximation of what get_clan_id() does under the hood)


I tried that with a different ID, in the mini browser and logging into KoL and manipulating URLs without mafia. Same result. But if it works for you then it is me or my environment and not immediately relevant.
 

heeheehee

Developer
Staff member
(/goto showplayer.php?who=354981 in chat in vanilla KoL also successfully loads my profile, for what it's worth.)
 

fronobulax

Developer
Staff member
(/goto showplayer.php?who=354981 in chat in vanilla KoL also successfully loads my profile, for what it's worth.)

So maybe my problem is just that I was thinking I was looking at a "browser" command, not a chat command (says the player who never uses chat and maintains a character who has not visited the Altar of Literacy).
 

gumpy13x

New member
And now it it's not working again.

get_clan_id() still only ever equals zero and I'm not getting any value for get_clan_name() anymore.

I haven't updated mafia at all, which makes me think this is something on KoL's end.
 

MCroft

Developer
Staff member
r20926 gives me my clan:
Code:
> ashq print(get_clan_name());
The A For Effort Team

> ashq print(get_clan_id());
19179

> ashq print(get_player_id(my_name()));
263717

I can only suggest defensive programming. You may need to start hard coding things, since those clan numbers are unlikely to change. Or take them as CLI parameters.

Or get them in line 1 of the script and stash them in a variable and abort if you get 0...
 

gumpy13x

New member
I used r20926 as well, but this is what I got:

Code:
> ashq print(get_clan_name());



> ashq print(get_clan_id());



0



> ashq print(get_player_id(my_name()));



gumpy13    (#2036091), Because Gumpy29 was taken..

This player is    currently online in channel games and listening to clan, dread,    hardcore, hauntedhouse, talkie, trade and villa.



gumpy13


Something may be wrong.
 

MCroft

Developer
Staff member
under some circumstances (the player_id is not in the list of "seen" player_ids) the game does a /whois <name> in chat, but doesn't return it in the function (just to the gCLI). There's no foul to that in the gCLI, but who knows if there's some race condition in what you're doing that causes a failure. For me the /whois gumpy13 command has a link that takes me to your show player page. I'm wondering if the reason that's in get_player_id is to force the game to populate values.

So, does this happen immediately after changing clans, after restart, only from scripts, etc?
 

gumpy13x

New member
under some circumstances (the player_id is not in the list of "seen" player_ids) the game does a /whois <name> in chat, but doesn't return it in the function (just to the gCLI). There's no foul to that in the gCLI, but who knows if there's some race condition in what you're doing that causes a failure. For me the /whois gumpy13 command has a link that takes me to your show player page. I'm wondering if the reason that's in get_player_id is to force the game to populate values.

So, does this happen immediately after changing clans, after restart, only from scripts, etc?
Starting mafia and immediately running the above commands through the gCLI gives me the results from my previous post. It does the same thing when I run the commands via a script.
 

MCroft

Developer
Staff member
Can you bring up your clan in the web browser?

When you start up KolMafia, is there a line in your gCLI that says
Rich (BB code):
Loading character status...
[....]
You are currently a member of The A For Effort Team
?
 

gumpy13x

New member
Can you bring up your clan in the web browser?

When you start up KolMafia, is there a line in your gCLI that says
Rich (BB code):
Loading character status...
[....]
You are currently a member of The A For Effort Team
?
I can bring up my clan in my web browser, but I don't have a line like that when I log in.
 

MCroft

Developer
Staff member
I can bring up my clan in my web browser, but I don't have a line like that when I log in.
OK, please logout. Select Start Debug Log from the Help Menu, then login. As soon as it comes to rest, stop the debug log. Post it here.
 

gumpy13x

New member
The file was too big, so I had to break it up.
 

Attachments

  • DEBUG_20210914part1.txt
    580.3 KB · Views: 2
  • DEBUG_20210914part2.txt
    878.6 KB · Views: 2
Top