Page 2 of 3 FirstFirst 1 2 3 LastLast
Results 11 to 20 of 23

Thread: matcher issue

  1. #11
    Developer
    Join Date
    Aug 2009
    Posts
    2,960

    Default

    I don't have an answer as to why running the same script on two different characters / machines would yield different results. As frono implies, \w matches a "word" character, which may differ depending on your language settings. I don't think anything else in this script should vary by Java version or OS; if it does, file a bug.

  2. #12
    Developer fronobulax's Avatar
    Join Date
    Feb 2009
    Location
    Central Virginia, USA
    Posts
    4,430

    Default

    I don't have an answer as to why running the same script on two different characters / machines would yield different results. As frono implies, \w matches a "word" character, which may differ depending on your language settings. I don't think anything else in this script should vary by Java version or OS; if it does, file a bug.
    Originally Posted by heeheehee View Post
    I asked because in Ye Olden Days I had code that did not work because of things like: different default charsets; different case sensitivities; Java system properties; and so on. Asking the questions is my knee jerk reaction to "it works on one computer but not the other".

    As a debugging hint, I would consider getting the url string, doing a global subsitiution of underbar ("_") for space and then trying the matcher. That will highlight the cases where KoL is not consistent in the use of whitespace.
    Well, thank you.
    Originally Posted by Veracity View Post

  3. #13
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    470

    Default

    Namely, there are two spaces after "last".

    Code:
    "clanmate (\\w+) is in charge of the table, having won the last  (\\d+)"
    should match this particular case, although that will break if a playername containing spaces is on top of the table. I'd suggest using something like
    Code:
    [a-zA-Z0-9_ ]+
    or just
    Code:
    [\\w ]+
    (note the space in each of these)
    Originally Posted by heeheehee View Post
    The 2 spaces was doing me in. I never would have thought of that!

    Here's what I ended up putting.
    Code:
    	matcher n_stash_put = create_matcher( "clanmate ([\\w\\s]+) is in charge of the table, having won the last  (\\d+)" , PVPHill );
    I use the ([\\w\\s]+) on a different script, which has never given me issues. And now that I'm looking at that, I can fix a different script that was giving me grief too.

    Thanks for your help. Much appreciated!
    Scripts I have written:
    Unlock Dread A Script to save you a bunch of clicks.
    Standard Rollover Bonus A Script that shows best items to pull/equip for bonus turns.
    Standard PVP Bonus A Script that shows the best items to pull/equip for bonus PVP Fights.
    Rollover Management A Script that does all the daily deeds you might have forgotten, or might have missed.
    Chatbot A Chatbot script. Simple start for those who want/need one for their clan.
    Zap Wand A Dungeon of Doom ZAP WAND getting script.

  4. #14
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    470

    Default

    So here's some interesting information.
    I upgraded Java this morning, because the script failed on the other computer.

    The script works for me, but there's something strange going on. I was on the computer that was having an issue. I ended up putting my settings folder, and a copy of build 19136, in a separate folder. Opened a "new" instance mafia, ran script, no problem, worked perfect. Logged out of my account, and logged into my multi account (to create a brand new settings file), without closing the mafia login window. Ran script, and it failed.


    On my main computer: I opened the mafia that I use all the time.

    I logged on another existing multi, one which had settings already on the computer, and ran into the same issue.

    I even copy/pasted/renamed my "pazsox_prefs" file into the multi's name, and the script failed.

  5. #15
    Developer
    Join Date
    Aug 2009
    Posts
    2,960

    Default

    To confirm, your multi has a VIP key and isn't in a path with Standard restrictions?

    i.e. can you access the pool table in the relay browser? Does the visit_url contain the HTML on your multi as expected? Sounds like the problem is tied to the account, not the script.

  6. #16
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    470

    Default

    To confirm, your multi has a VIP key and isn't in a path with Standard restrictions?

    i.e. can you access the pool table in the relay browser? Does the visit_url contain the HTML on your multi as expected? Sounds like the problem is tied to the account, not the script.
    Originally Posted by heeheehee View Post
    This is all correct. The multi I wrote this script for is not under standard restrictions, and does in fact have the VIP key. They actually have control of the table also. Which is why I'm so confused.
    Scripts I have written:
    Unlock Dread A Script to save you a bunch of clicks.
    Standard Rollover Bonus A Script that shows best items to pull/equip for bonus turns.
    Standard PVP Bonus A Script that shows the best items to pull/equip for bonus PVP Fights.
    Rollover Management A Script that does all the daily deeds you might have forgotten, or might have missed.
    Chatbot A Chatbot script. Simple start for those who want/need one for their clan.
    Zap Wand A Dungeon of Doom ZAP WAND getting script.

  7. #17
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    470

    Default

    I found the problem.

    Here's what you see when you are in charge of the table:

    Looks like you're in charge of the table, having won the last 113 games in a row.

    Here's what everyone else sees:
    Looks like your clanmate Ruby is in charge of the table, having won the last 113 games in a row.

    Makes sense now that the matcher would fail. The text is completely different. I can't believe I didn't think of this. Sorry for causing so much trouble.
    Scripts I have written:
    Unlock Dread A Script to save you a bunch of clicks.
    Standard Rollover Bonus A Script that shows best items to pull/equip for bonus turns.
    Standard PVP Bonus A Script that shows the best items to pull/equip for bonus PVP Fights.
    Rollover Management A Script that does all the daily deeds you might have forgotten, or might have missed.
    Chatbot A Chatbot script. Simple start for those who want/need one for their clan.
    Zap Wand A Dungeon of Doom ZAP WAND getting script.

  8. #18
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    470

    Default

    Sounds like the problem is tied to the account, not the script.
    Originally Posted by heeheehee View Post
    That is absolutely correct.

    Here's my work around. Seems so simple, I feel kind of dumb for not thinking of this sooner.

    Code:
    	string Pooltable= visit_url( "clan_viplounge.php?action=pooltable&whichfloor=2" );
    	if ((my_name() == "ruby") && Pooltable.contains_text("showplayer.php?who=599575"))
    		{
    		matcher n_stash_put = create_matcher( "Looks like you're in charge of the table, having won the last  (\\d+)" , Pooltable );
    		}
    	if ((my_name() != "ruby") && Pooltable.contains_text("showplayer.php?who=599575"))
    		{
    		matcher o_stash_put = create_matcher( "clanmate ([\\w\\s]+) is in charge of the table, having won the last  (\\d+)" , Pooltable );
    		}
    	if (!Pooltable.contains_text("showplayer.php?who=599575"))
    		{
    		matcher o_stash_put = create_matcher( "clanmate ([\\w\\s]+) is in charge of the table, having won the last  (\\d+)" , Pooltable );
    		}
    Now the script will look at the table, and only print out whats relevant, regardless of the account I'm using. I've run this, and it does work. Thank you for your help. I greatly appreciate it.
    Last edited by Pazleysox; 03-22-2019 at 01:11 PM. Reason: [/code]
    Scripts I have written:
    Unlock Dread A Script to save you a bunch of clicks.
    Standard Rollover Bonus A Script that shows best items to pull/equip for bonus turns.
    Standard PVP Bonus A Script that shows the best items to pull/equip for bonus PVP Fights.
    Rollover Management A Script that does all the daily deeds you might have forgotten, or might have missed.
    Chatbot A Chatbot script. Simple start for those who want/need one for their clan.
    Zap Wand A Dungeon of Doom ZAP WAND getting script.

  9. #19
    Developer
    Join Date
    Aug 2009
    Posts
    2,960

    Default

    FYI you can use a matcher with alternation to handle both of these cases, e.g. something like
    Code:
    "Looks like (you're|your clanmate (.*?) is) in charge of the table, having won the last  (\\d+) games in a row"
    ...
    if (m.group(1) == "you're") {
      player = my_name();
    } else {
      player = m.group(2);
    }

  10. #20
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    470

    Default

    I think I found a bug? I was working with an existing matcher today, and it failed, where it had never failed before. The matcher is supposed to pull a players clan name from their character sheet. I spent some time mulling over it, and trying to work out why it failed. I could get it to work on some characters, and then one in perticular it wouldn't work.

    The character it would fail on had a space in their name, so I looked at other players with a space, and it worked fine.

    I finally figured out that the character in question has 0 permanent skills. So I looked around, and I found #13 (Mr. Skullhead), who fit the bill. Space in his name, no permanent skills, and the script failed on him also. It worked on every other account that I tested that has permanent Skills. I could not find a player who PVP's, and has not ascended. Not to say one doesn't exist, just that I have not found one as of this post.

    Code:
    void main()
    {
    	string whowho = visit_url( "showplayer.php?who=" + get_player_id( spaz ox ) );
    	matcher classy = create_matcher("whichclan=(\\d+)\">([^<]+)", whowho);
    	if(find(classy)) 
    	{
    	set_property("_classy2", classy.group(2)); // set name of clan player PVP's for
     	int I=0;
    while( I<1 )
    {
    classy.find();
    I=I+1;
    string group1= classy.group( 1 );
    string group2= classy.group( 2 );
    
    
    	if(get_property("_classy2") != group2) // Look at a players PVP clan, if different, don't use it.  The matcher will actually pick up both.
    		set_property("_classy2", group2); // this is the clan the player is in when the script is run.
    
    	print("Player: " + get_property("_sender") + ", Clan: " + get_property("_classy2"));
    }}}
    For the time being, I'm putting in a check for permanent skills, and if the words aren't found, the script will return that information.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •