[MacroMod] Periodic Trade Messages Macro

Discussion in 'Basic Tutorials' started by 3point, Aug 9, 2015.

  1. 3point

    3point Assαssιη Ex-EcoLegend
    Builder ⛰️ Ex-EcoLegend ⚜️⚜️⚜️⚜️ Prestige ⭐ II ⭐ Premium Upgrade

    Joined:
    Sep 3, 2012
    Messages:
    778
    Trophy Points:
    68,410
    Gender:
    Male
    Ratings:
    +728
    Have you ever wanted to put an ad up without worrying about having to constantly type it out every time? Have you been wondering if there was a way to periodically advertise in trade channel with a simple macro installation and extremely easy to follow interface? Introducing...

    [Periodic Trade Messages Macro] v1.0
    Developed by 3point14mp

    This is an automated trade messages macro featuring
    • Many options to customize to your preferences
    • Seamless Integration into ECC's plugins. Includes a /help ad section to show this macro's available commands.
    • Several fail-safe features built-in to ensure you don't break chat rules. For example, if you accidentally spam the key to start the ad, it will say you can only put an ad every 180 seconds or longer
    • Clear documentation explaining each available command
    • Extremely simple to set up - follow instructions below
    • Throughly tested and working to expectations
    • Compatible with your other macros
    • Free!

    Commands
    • /help ad | /help ads
      • Shows the list of commands available
    • /ad set 1 msg
      • Sets the line of your first of two possible ad messages to msg
    • /ad set 2 msg
      • Sets the line of your second ad message to msg
    • /ad clear
      • Clears your stored first and second-line ad messages
    • /ad clear 1
      • Clears your first-line ad message
    • /ad clear 2
      • Clears your second-line ad message
    • /ad time seconds
      • Sets the time between trade ads send to trade channel
      • Must be at least 180 seconds to comply with EcoCityCraft rules
    • /ad info
      • Displays stored ads and the status of your macro
    Example use of macro
    Say I wanted to advertise that I'm selling prot 4 sets for 16k each. I would do "
    /ad set 1 Selling Prot 4 sets for 16k each. PM me". Then if I only wanted this to show, I would make sure to do "/ad clear 2" in case I have anything planned as a second ad from before. The default time between ads will be 180 seconds, or 3 minutes. Say it was off-peak and I wanted to be less spammy. I would do "/ad time 300" to make it say the ad every 5 minutes instead. Once I have all this configured I would simply press the key binded to start the macro. You can turn it off whenever by pressing it again.

    Say I then wanted to add I'm selling maxed bows and swords. I would simply add "
    /ad set 2 Selling maxed bows and swords! PM me". Then you would have 2 trade messages advertising selling prot 4 and maxed swords/bows every 5 minutes with these settings.

    Testimonials

    [​IMG]

    [​IMG]

    [​IMG]

    [​IMG]

    [​IMG]

    [​IMG]

    [​IMG]

    "Before 3point14mp's Trade macro, my life was a bore. I rarely did ads because I couldn't deal with retyping or accidentally wrong chatting. 3point14mp's automated trade message macro turned my life around! With all new features such as the time frame of the said ad, to even /help ad. It's amazing! I definitely recommend this to others! Great work 3point, you rock!"
    ~Trey_B


    Installation Instructions

    1. Make sure you have MacroMod installed - if not, follow @314's useful tutorial on setting up [1.8] MacroMod

    2. In the MacroMod interface (open MacroMod interface by holding SHIFT, then pressing ~), go to the text editor and make a new file called trade.txt
    [​IMG]

    3. Copy the following code into the file and then save the file
    Code:
    $${
    IF(@#trade_time<=180)
        SET(@#trade_time,180)
    ENDIF
    IF(%KEYNAME%=="onJoinGame")
        SET(@#trade_failsafe,0)
        UNSET(@tradead)
    ELSEIF(%KEYNAME%!="onSendChatMessage")
        IF(@tradead);
            LOG("&7[Tr] &eYou stopped advertising.")
            UNSET(@tradead)
        ELSE
            IF((%@#trade_failsafe%>=1) && (%@#trade_failsafe%<180))
                LOG("&7[Tr] &cYou have recently advertised under 3 minutes ago.")
            ELSE
                LOG("&7[Tr] &aYou started advertising.")
                SET(@tradead)
                #i=1
                DO()
                    IF(@tradead==false)
                        UNSET(@trade_breaknow)
                        DO()
                        INC(@#trade_failsafe)
                        WAIT(1000ms)
                        IF(@trade_breaknow)
                            UNSET(@trade_breaknow)
                            BREAK
                        ENDIF
                        WHILE(@#trade_failsafe<=180)
                        BREAK
                    ENDIF
                    @#trade_failsafe=#i
                    IF(#i==1)
                        IF(@&tradead1!="")
                            ECHO("/ch qm tr %@&tradead1%")
                        ENDIF
                        IF(@&tradead2!="")
                            ECHO("/ch qm tr %@&tradead2%")
                        ENDIF
                    ENDIF
                    WAIT(1000ms)
                    INC(#i)
                    IF(#i>%@#trade_time%)
                        #i=1
                    ENDIF
                LOOP
            ENDIF
        ENDIF
    ELSE
        IFMATCHES(%CHAT%, "^/help (ad|ads)")
            FILTER
            LOG(" &e---- &6Help: ad &e-- &6Page &c1 &6of &c1 &e----")
            LOG("&7&lAutomated Advertisements Macro v1.0")
            LOG("&7&oDeveloped by 3point14mp")
            LOG("&3/ad set 1 &bmsg &7- sets your first-line ad message")
            LOG("&3/ad set 2 &bmsg &7- sets your second-line ad message")
            LOG("&3/ad clear &7- clears your stored ad messages")
            LOG("&3/ad clear 1 &7- clears your first-line ad message")
            LOG("&3/ad clear 2 &7- clears your second-line ad message")
            LOG("&3/ad time &bseconds &7- sets time between each ad (minimum 180)")
            LOG("&3/ad info &7- displays stored ads and the status of your macro")
        ENDIF
        IFMATCHES(%CHAT%, "^/ad set 1$")
            FILTER
            LOG("&fSets your first of two allowable trade ads.")
            LOG("&f/ad set 1 <message>")
        ENDIF
        IFMATCHES(%CHAT%, "^/ad set 2$")
            FILTER
            LOG("&fSets your second allowable trade ad.")
            LOG("&f/ad set 2 <message>")
        ENDIF
        IFMATCHES(%CHAT%, "^/ad set 1 ")
            FILTER
            MATCH(%CHAT%, "^/ad set 1 (.+)",{&newad})
            @&tradead1=%&newad%
            LOG("&7[Tr] &b&oFirst-line Trade Ad Set To")
            LOG("&7[Tr] &f%&newad%")
            @#trade_failsafe=0
            @trade_breaknow=true
        ENDIF
        IFMATCHES(%CHAT%, "^/ad set 2 ")
            FILTER
            MATCH(%CHAT%, "^/ad set 2 (.+)",{&newad})
            @&tradead2=%&newad%
            LOG("&7[Tr] &b&oSecond-line Trade Ad Set To:")
            LOG("&7[Tr] &f%&newad%")
            @#trade_failsafe=0
            @trade_breaknow=true
        ENDIF
        IFMATCHES(%CHAT%, "^/ad clear$")
            FILTER
            @&tradead1=""
            @&tradead2=""
            LOG("&7[Tr] &dCleared First/Second-line Trade Ads")
            @#trade_failsafe=0
            @trade_breaknow=true
        ENDIF
        IFMATCHES(%CHAT%, "^/ad clear 1$")
            FILTER
            @&tradead1=""
            LOG("&7[Tr] &dCleared First-line Trade Ad")
            @#trade_failsafe=0
            @trade_breaknow=true
        ENDIF
        IFMATCHES(%CHAT%, "^/ad clear 2$")
            FILTER
            @&tradead2=""
            LOG("&7[Tr] &dCleared Second-line Trade Ad")
            @#trade_failsafe=0
            @trade_breaknow=true
        ENDIF
        IFMATCHES(%CHAT%, "^/ad time$")
            FILTER
            LOG("&fSets the time between ads. Must be at least 180 seconds.")
            LOG("&f/adtime <seconds>")
        ENDIF
        IFMATCHES(%CHAT%, "^/ad time ")
            FILTER
            MATCH(%CHAT%,"^/ad time (.+)",{&newtime})
            SET(#newtime,%&newtime%)
            IF(#newtime<180)
                LOG("&7[Tr] &cError: Must keep ads at least &e180 &cseconds apart")
            ELSE
                @#trade_time=%#newtime%
                LOG("&7[Tr] &aSet time between ads to &e%#newtime% &aseconds")
            ENDIF
        ENDIF
        IFMATCHES(%CHAT%, "^/ad info")
            FILTER
            IF((@&tradead1=="") && (@&tradead2==""))
                LOG("&7[Tr] You do not currently have any trade ad messages.")
            ELSE
                LOG("&7[Tr] Your planned ad messages are")
                IF(@&tradead1!="")
                    SPLIT(" ","%@&tradead1%",&split[])
                    FOR(#j,4,75)
                        IF(&split[%#j%]==""); BREAK; ENDIF
                        SET(&split[%#j%],"&7%&split[%#j%]%)
                    NEXT
                    JOIN(" ","&split[]",&t1)
                    LOG("&7[Tr] &fFirst-line: &7%&t1%")
                ENDIF
                IF(@&tradead2!="")
                    SPLIT(" ","%@&tradead2%",&split2[])
                    FOR(#j,4,75)
                        IF(&split2[%#j%]==""); BREAK; ENDIF
                        SET(&split2[%#j%],"&7%&split2[%#j%]%)
                    NEXT
                    JOIN(" ","&split2[]",&t2)
                    LOG("&7[Tr] &fSecond-line: &7%&t2%")
                ENDIF
                LOG("&7[Tr] &6Scheduled time between ads: &e%@#trade_time% &6seconds")
                IF((%@#trade_failsafe%>0) && (%@#trade_failsafe%<=180))
                    LOG("&7[Tr] &6Status: &cYour last automated ad was &e%@#trade_failsafe% &cseconds ago")
                ELSE
                    LOG("&7[Tr] &6Status: &aMacro ready to use")
                ENDIF
            ENDIF
        ENDIF
    ENDIF
    }$$

    4. Now go to Macro Binding: Keys and click on the button you want to use to start the trade message macro. In this example I used 'T'. Then add $$<trade.txt> to the line and press save.
    [​IMG]

    5. Next, go to
    Macro Binding: Events and click on onSendChatMessage (don't confuse this with onChat), located as the last event on the right. Then add also $$<trade.txt> in front of whatever you may currently have on the line and press save.
    [​IMG]
    [​IMG]


    6. Finally, click on onJoinGame, located as the first event on the left. Then add also $$<trade.txt> in front of whatever you may currently have on the line and press save.
    [​IMG]
    [​IMG]
    You're Done!


    Now type /help ad to see the list of commands available to get started.
    I hope you enjoy this macro if you decide to use it. Please comment below with suggestions and feedback and any bugs that need fixing.


    Also, major thanks to @Chundi_Jr, @xX3PICREBELXx and @Trey_B for being patient testers!

    ~Sponsored by Chundi_Jr
    3point14mp
     
    • Winner Winner x 17
    • Agree Agree x 1
    • Informative Informative x 1
    • Useful Useful x 1
    • List
    #1 3point, Aug 9, 2015
    Last edited: Aug 16, 2015
  2. Chundi_Jr

    Chundi_Jr Ex-Rebecca
    Resident ⛰️ Ex-EcoLegend ⚜️⚜️⚜️⚜️ Prestige ⭐ VII ⭐ Premium Upgrade

    Joined:
    Apr 4, 2014
    Messages:
    1,733
    Trophy Points:
    70,160
    Gender:
    Female
    Ratings:
    +1,994
    This macro is absolutely amazing!!! 3point is a genius! Must be from all the iced caps he drinks........
     
  3. Canadian_Apple

    Canadian_Apple Builder
    Builder ⛰️ Ex-Tycoon ⚜️⚜️⚜️

    Joined:
    Dec 2, 2012
    Messages:
    681
    Trophy Points:
    57,660
    Gender:
    Male
    EcoDollars:
    $0
    Ratings:
    +3,302
  4. xX3PICREBELXx

    Builder ⛰️ Ex-EcoMaster ⚜️⚜️⚜️⚜️ Premium Upgrade

    Joined:
    Apr 28, 2012
    Messages:
    2,201
    Trophy Points:
    54,090
    Gender:
    Male
    Ratings:
    +2,608
    It literally has a /help.. amazing.
    [​IMG]
     
  5. Ellie27

    Ellie27 ♛ Princess ♛
    Builder ⛰️ Ex-Tycoon ⚜️⚜️⚜️ Premium Upgrade

    Joined:
    Jun 16, 2013
    Messages:
    241
    Trophy Points:
    38,390
    Gender:
    Female
    Ratings:
    +737
    Great job Squill!
     
  6. somkar8

    somkar8 Builder
    Builder ⛰️ Ex-Mayor ⚒️⚒️

    Joined:
    Apr 2, 2015
    Messages:
    574
    Trophy Points:
    16,490
    Ratings:
    +170
    Wow. Very nice job and coding 314... I'll definitly use this the second I get Macro mod!
     
  7. Imaginex

    Imaginex Living in a Daydream
    President ⛰️⛰️ Ex-EcoLegend ⚜️⚜️⚜️⚜️ Prestige ⭐ I ⭐ Gameplay Architect Premium Upgrade

    Joined:
    Mar 6, 2014
    Messages:
    1,945
    Trophy Points:
    72,660
    Gender:
    Female
    EcoDollars:
    $5,655,100
    Ratings:
    +1,244
    O,O looks amazing, can't wait to try it our
     
  8. AdmiralD

    AdmiralD IsleTradingCo
    President ⛰️⛰️ Ex-EcoLegend ⚜️⚜️⚜️⚜️ Prestige ⭐ V ⭐ Premium Upgrade

    Joined:
    Jul 26, 2013
    Messages:
    6,105
    Trophy Points:
    97,160
    Gender:
    Male
    Ratings:
    +4,290
    What an awesome contribution! I only wish that there was some way I could figure out how to install - too many steps and too much headache for an old man :p
     
  9. 314

    314 Irratioπal President, former ServerAdmin
    Mythic ⚔️ I ⚔️ President ⛰️⛰️ Ex-President ⚒️⚒️ Premium Upgrade

    Joined:
    Apr 1, 2014
    Messages:
    6,963
    Trophy Points:
    87,660
    EcoDollars:
    $0
    Ratings:
    +4,866
    <3

    Very nice macro... although I don't intend to use it (I rarely advertise... :p), it looks very professional. *Applauds and bows down to the creator*
     
  10. Natelev

    Natelev Skyblock Mod
    Builder ⛰️ Ex-EcoLeader ⚜️⚜️⚜️ Prestige ⭐ V ⭐ Premium Upgrade

    Joined:
    Dec 29, 2012
    Messages:
    431
    Trophy Points:
    58,260
    EcoDollars:
    $1,031,351
    Ratings:
    +290
    Amazing macro, I'm definitely going to install and use it. Thanks for making something like this free for the whole community to use, it's nice to see someone do something like this just to help out other players :)
     
    #10 Natelev, Aug 10, 2015
    Last edited: Aug 10, 2015
  11. icondigi

    icondigi FuryFudge Lover
    Mayor ⛰️⛰️ Ex-EcoLegend ⚜️⚜️⚜️⚜️ Prestige ⭐ II ⭐ Premium Upgrade

    Joined:
    Oct 3, 2012
    Messages:
    2,123
    Trophy Points:
    78,060
    Gender:
    Male
    Ratings:
    +2,466
    Absolutely amazing! Helpful and easy! 3point you're a genius!
     
  12. 3point

    3point Assαssιη Ex-EcoLegend
    Builder ⛰️ Ex-EcoLegend ⚜️⚜️⚜️⚜️ Prestige ⭐ II ⭐ Premium Upgrade

    Joined:
    Sep 3, 2012
    Messages:
    778
    Trophy Points:
    68,410
    Gender:
    Male
    Ratings:
    +728
    I'd like to thank you guys very much for leaving such encouraging feedback on this tutorial :D It makes me very happy that I was able to help at least 1 other person improve their gameplay experience.
    Feedback really motivates me to release more useful macros in the future, improve on existing ones, and also ensure the next macros I release will be as simple to use, very useful and practical, and developed with attention to detail.
     
    • Like Like x 1
    • Winner Winner x 1
    • List
  13. 314

    314 Irratioπal President, former ServerAdmin
    Mythic ⚔️ I ⚔️ President ⛰️⛰️ Ex-President ⚒️⚒️ Premium Upgrade

    Joined:
    Apr 1, 2014
    Messages:
    6,963
    Trophy Points:
    87,660
    EcoDollars:
    $0
    Ratings:
    +4,866
    You dare to confuse Pi with Pi? :eek:
    *Tags @3point14mp * :X3:
     
    • Creative Creative x 1
    • Potato Potato x 1
    • List
  14. somkar8

    somkar8 Builder
    Builder ⛰️ Ex-Mayor ⚒️⚒️

    Joined:
    Apr 2, 2015
    Messages:
    574
    Trophy Points:
    16,490
    Ratings:
    +170
    Get the United Nations! The War of Pi has begun! Oh wait, it just disbanded. Piville is doomed unless Pi gets reinforcements. Wait, not the enemy Pi, the Piville Pi. Wait. Which Pi is Pi? Pi.
     
  15. Ichins

    Ichins Resident
    Resident ⛰️ Ex-Tycoon ⚜️⚜️⚜️

    Joined:
    Nov 3, 2012
    Messages:
    189
    Trophy Points:
    27,290
    Gender:
    Male
    Ratings:
    +297
    Thanks squill :D
     
  16. Turt201444444444

    Builder ⛰️ Ex-President ⚒️⚒️

    Joined:
    Apr 15, 2014
    Messages:
    1,067
    Trophy Points:
    26,590
    Gender:
    Male
    Ratings:
    +1,101
    Incredible macro, must've taken forever, recommend it as it's also just so easy to use-it even has a menu O-O
     
    • Agree Agree x 1
    • Friendly Friendly x 1
    • List
  17. Imaginex

    Imaginex Living in a Daydream
    President ⛰️⛰️ Ex-EcoLegend ⚜️⚜️⚜️⚜️ Prestige ⭐ I ⭐ Gameplay Architect Premium Upgrade

    Joined:
    Mar 6, 2014
    Messages:
    1,945
    Trophy Points:
    72,660
    Gender:
    Female
    EcoDollars:
    $5,655,100
    Ratings:
    +1,244
    Love using it, and although I don't give out a bunch of ads using this, it makes broadcasting the one's I do very easy. First time using Macro-mod for ads, and let me tell you that I love the way this one is set up <3
     
  18. ChargerBoltz5

    ChargerBoltz5 Builder
    Builder ⛰️ Ex-President ⚒️⚒️

    Joined:
    Jun 30, 2014
    Messages:
    1,397
    Trophy Points:
    28,090
    Gender:
    Male
    EcoDollars:
    $0
    Ratings:
    +1,340
    I've never used macromod before, but I surely will be installing it tomorrow, and this will be the first one I use. I use trade ads for my spawnshop all the time ingame... but my current method is kinda tedious (/wild land to some deserted place, go into local chat, scroll back up to the last time I said the ad, go into trade chat, say ad). I'm absolutely looking forward to using this tutorial, and it looks very well-done and like you put quite a good amount of time and effort into it. Very well done, @3point14mp, and thanks again!
     
  19. stoler202

    stoler202 Builder
    Builder ⛰️ Ex-President ⚒️⚒️

    Joined:
    Aug 3, 2012
    Messages:
    1,701
    Trophy Points:
    32,660
    EcoDollars:
    $0
    Ratings:
    +471
    How do you guys even write these scripts? Are there any tutorials around? I'm looking into writing my own since I have a very good idea and don't want people to use it themselves :p
     
  20. Ninjaboy3113

    Ninjaboy3113 Γհε Ŋυβ
    Builder ⛰️ Ex-President ⚒️⚒️ Premium Upgrade

    Joined:
    Feb 11, 2014
    Messages:
    298
    Trophy Points:
    30,990
    Gender:
    Male
    EcoDollars:
    $0
    Ratings:
    +213
    Thank you so much 3point! this is absolutely amazing :)