Page 2 of 2 FirstFirst 1 2
Results 11 to 15 of 15

Thread: Clan Fortune Script

  1. #11
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    11,421

    Default

    And "fortune" is a built-in command. You override it with your script name?

  2. #12

    Default

    Here's how I would do that same script.

    Code:
    void main()
    {
    cli_execute ("/whitelist bonus");
    cli_execute ("fortune quicksend");
    wait (5;)
    cli_execute ("fortune quicksend");
    wait (5);
    cli_execute ("fortune quicksend");
    cli_execute ("/whitelist ferengi");
     }

    First, the command is "fortune (XXX)" not clanfortune (XXX). Second wait (X); needs to be it's own command, it's not a cli command. I would put a delay of at least 5, unless the bot is super fast
    Originally Posted by Pazleysox View Post

    And "fortune" is a built-in command. You override it with your script name?
    Originally Posted by Veracity View Post

    Thanks guys for the advice.

    I actually thought it had to put "clanfortune" in front because the script name is clanfortune.ash and on the github page, they had other commands which started with clanfortune (e.g clanfortune help, clanfortune defaults,<setting name>,<setting>)

    I recall typing "clanfortune quicksend" in the gCLI manually and it worked for me.

    But I find it a little odd that the command "quicksend" did not work, since on the github page, the command was only "quicksend".

    How did you guys manage to find out it was "fortune quicksend"?
    Last edited by littlereddot11; 04-07-2018 at 04:23 PM.

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

    Default

    Wait is totally a valid cli command, so either version should work.
    Originally Posted by the dictator View Post


    Correct, my mistake. You can also use

    waitq(#);

    The q will make it silent, and not show the countdown.

  4. #14

    Default

    Just popping in to say I made a little code snippet based off this script, which pretty cleanly handles auto-responding to all clannies awaiting a consultation response from you. Mafia already has built-in functionality for sending out requests, and has built-in preferences for what words to use when sending and responding to fortunes, so I figure the only real thing that wants to be scripted is auto-replying, and it should use those preferences. I think your script was made before mafia added such functionality, and it seems a wee bit ridiculously complex to me, so I just made my own. (Initially I tried to do it all on my own, but hit a minor roadblock when my usual method of scoping out button-sourced URLs, the Mini-Browser, wouldn't work for some reason, so I just looked up your script to see what the URL was. I wound up copying more than that, though, since your regex was better than mine )

    So without further ado, here's the snippet:

    Code:
    buffer page = visit_url("clan_viplounge.php?preaction=lovetester");
    
    string [int][int] request_array = page.group_string("(clan_viplounge.php\\?preaction=testlove&testlove=\\d*)\">(.*?)</a>");
    
    foreach i in request_array {
    	string response_url = request_array[i][1].replace_string("preaction\=testlove","preaction\=dotestlove") + "&pwd&option=1&q1=" + get_property("clanFortuneReply1") + "&q2=" + get_property("clanFortuneReply2") + "&q3=" + get_property("clanFortuneReply3");
    	visit_url(response_url);
    	print("Response sent to " + request_array[i][2] + ".", "green");
    }
    You can just save that as an .ash file and run it to auto-respond using mafia's built-in prefs (clanFortuneReply1, clanFortuneReply2, and clanFortuneReply3).

  5. #15
    Senior Member
    Join Date
    Oct 2017
    Posts
    306

    Default

    Just popping in to say I made a little code snippet based off this script, which pretty cleanly handles auto-responding to all clannies awaiting a consultation response from you. Mafia already has built-in functionality for sending out requests, and has built-in preferences for what words to use when sending and responding to fortunes, so I figure the only real thing that wants to be scripted is auto-replying, and it should use those preferences. I think your script was made before mafia added such functionality, and it seems a wee bit ridiculously complex to me, so I just made my own. (Initially I tried to do it all on my own, but hit a minor roadblock when my usual method of scoping out button-sourced URLs, the Mini-Browser, wouldn't work for some reason, so I just looked up your script to see what the URL was. I wound up copying more than that, though, since your regex was better than mine )

    So without further ado, here's the snippet:

    Code:
    buffer page = visit_url("clan_viplounge.php?preaction=lovetester");
    
    string [int][int] request_array = page.group_string("(clan_viplounge.php\\?preaction=testlove&testlove=\\d*)\">(.*?)</a>");
    
    foreach i in request_array {
        string response_url = request_array[i][1].replace_string("preaction\=testlove","preaction\=dotestlove") + "&pwd&option=1&q1=" + get_property("clanFortuneReply1") + "&q2=" + get_property("clanFortuneReply2") + "&q3=" + get_property("clanFortuneReply3");
        visit_url(response_url);
        print("Response sent to " + request_array[i][2] + ".", "green");
    }
    You can just save that as an .ash file and run it to auto-respond using mafia's built-in prefs (clanFortuneReply1, clanFortuneReply2, and clanFortuneReply3).
    Originally Posted by Malurth View Post
    Thanks. I started using it and it works great for automatic replying.

Posting Permissions

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