Results 1 to 6 of 6

Thread: matcher issue

  1. #1
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    412

    Default matcher issue

    Why does this fail:
    Code:
    void main()
    {
    	string thesea = visit_url("main.php");
    	matcher need = create_matcher( "title=\"(\w+) (\w+)" , thesea );
    		{
    		need.find();
    		string group1= need.group( 1 );
    			{
    			print(group1);
    			}
    		}
    }
    and this works:
    Code:
    	string CheckGrinderNext= visit_url( "inventory.php?action=grind" );
    	matcher need = create_matcher( "needs (\\d+)" , CheckGrinderNext );
    			{
    			need.find();
    			string group1= need.group( 1 );
    				{
    				if ((group1) >= 1)
    					{
    					print("You need to grind more stuff to make sausage", "red");
    					}
    				}
    			}
    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.

  2. #2
    Senior Member
    Join Date
    Apr 2009
    Posts
    1,824

    Default

    Code:
    (\w+) (\w+)"
    Perhaps start by escaping those backslashes?
    (they are escaped in the "(\\d+)" example that works).

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

    Default

    I'm sorry my original post didn't have the \\. It IS in the script, and still didn't work.

  4. #4
    Senior Member Crowther's Avatar
    Join Date
    Nov 2006
    Posts
    1,439

    Default

    I'm sorry my original post didn't have the \\. It IS in the script, and still didn't work.
    Originally Posted by Pazleysox View Post
    When I fixed the \ vs \\ issue, your script "worked" for me. In that it matched something. It printed "Fight". Without your actual code, it is hard for people to help you.
    Code:
    void main()
    {
            string thesea = visit_url("main.php");
            matcher need = create_matcher( "title=\"(\\w+) (\\w+)" , thesea );
                    {
                    need.find();
                    string group1= need.group( 1 );
                            {
                            print(group1);
                            }
                    }
    }

  5. #5
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    412

    Default

    When I fixed the \ vs \\ issue, your script "worked" for me. In that it matched something. It printed "Fight". Without your actual code, it is hard for people to help you.
    Originally Posted by Crowther View Post
    I looked again, and I had missed the second \. I really thought I had fixed that. I did find the information I was looking for. Mafia will not allow you to create a matcher when mall.php is in the url.

    I was doing this:
    Code:
    buffer checkmall = visit_url("main.php");
    //	buffer checkmall = visit_url("mall.php");
    	matcher have = create_matcher( "(\\w+)" , checkmall );
    		{
    		have.find();
    		string group1= have.group( 1 );
    			{
    			print(group1);
    			}
    		}
    "html" was the output. It mattered not what it was, I just needed it to work.
    Code:
    //buffer checkmall = visit_url("main.php");
    buffer checkmall = visit_url("mall.php");
    	matcher have = create_matcher( "(\\w+)" , checkmall );
    
    		{
    		have.find();
    		string group1= have.group( 1 );
    			{
    			print(group1);
    			}
    		}
    No match attempted or previous match failed (00TEST - Copy.ash, line 8)
    at main (00TEST - Copy.ash:8)
    was my output. Unless I really screwed something up, the only thing I can think of is what I said above.

    Thank you Crowther for looking into this for me.
    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.

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

    Default

    This post said the mall is not directly accessible. 5 years ago.

Posting Permissions

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