1. MaxToMinimum President
    President ⛰️⛰️ Ex-Tycoon ⚜️⚜️⚜️

    Joined:
    Dec 25, 2013
    Messages:
    1,225
    Trophy Points:
    24,860
    Gender:
    Male
    Ratings:
    +313
    Hello,

    I want to have this command, that leaves all channels. I got it to work so it will leave all of them with a 1second delay, but I want to make sure that I actually leave sg and lotto.
    This means that there has to be some clause that if the chat matches "[ECC-SG] You will now receive SG broadcast messages", then it will do /sg messages again. Same with lottery, if the chat matches "[Lottery] You will now receive Lottery broadcast messages."

    It currently looks like this:
    $${
    ECHO("/leave g")
    Wait(1)
    ECHO("/leave l")
    Wait(1)
    ECHO("/leave tr")
    Wait(1)
    ECHO("/leave V")
    Wait(1)
    ECHO("/leave Auc")
    Wait(1)
    ECHO("/leave trv")
    Wait(1)
    ECHO("/leave SG")
    Wait(1)
    ECHO("/leave M")
    Wait(1)
    ECHO("/leave E")
    Wait(1)
    ECHO("/leave N")
    Wait(1)
    ECHO("/sg messages")
    Wait(1)
    ECHO("/lot messages")
    }$$
    I tried to use the "IFMATCHES" and other commands like that but couldn't figure out how to do it, and I can't find any macro references online.
     
    #1 MaxToMinimum, Dec 10, 2016
    Last edited: Dec 10, 2016
  2. 314 Irrational SuperMod, former ServerAdmin
    SuperMod EcoLegend ⛰️⛰️⛰️⛰️ Ex-President ⚒️⚒️ Prestige ⭐ VI ⭐ Premium Upgrade

    Joined:
    Apr 1, 2014
    Messages:
    7,055
    Trophy Points:
    97,160
    EcoDollars:
    $2,400,000
    Ratings:
    +4,921
    Regular expressions needed:
    Code:
    ^\[ECC-SG\] You will now receive SG broadcast messages.
    ^\[Lottery\] You will now receive Lottery broadcast messages.
    
    Macro code:
    Code:
    ECHO("/sg messages")
    WAIT(1)
    IFMATCHES(%CHATCLEAN%, "^\[ECC-SG\] You will now receive SG broadcast messages.")
    ECHO("/sg messages")
    WAIT(1)
    ENDIF
    ECHO("/lot messages")
    WAIT(1)
    IFMATCHES(%CHATCLEAN%, "^\[Lottery\] You will now receive Lottery broadcast messages.")
    ECHO("/lot messages")
    ENDIF
    
    This needs to be a separate macro using the onChat binding because utilizing chat in a script requires an event trigger.

    Small question: Since commands like /fly or /dtag have the option to specify "on" or "off" as a parameter - does the same apply to the /lot messages and /sg messages commands?
     
  3. MaxToMinimum President
    President ⛰️⛰️ Ex-Tycoon ⚜️⚜️⚜️

    Joined:
    Dec 25, 2013
    Messages:
    1,225
    Trophy Points:
    24,860
    Gender:
    Male
    Ratings:
    +313
    Does that mean I can make this code into its own text file, let's say sgleave.txt, and then put an EXEC(<sgleave.txt>) to run the sg and lottery leave, or am I just not reading that right?

    I am kind of confused on what you mean by "This needs to be a separate macro using the onChat binding because utilizing chat in a script requires an event trigger.", like what do you mean I should do?
     
  4. kukelekuuk C͕̹̲̽ͪ͐ͩ̔L̜̦̝͈ͦ̿̾̿ḘA̻̗̤̳̐ͭ̆̿̃̑ͭN̊̓͑̇ͯ
    Builder ⛰️ Ex-EcoLeader ⚜️⚜️⚜️ Premium Upgrade

    Joined:
    May 25, 2011
    Messages:
    10,061
    Trophy Points:
    80,160
    Ratings:
    +6,925
    Don't use that second script in onchat. That would quite literally spam /sg messages every time someone says something.
    314, you know better than that. You should at least test the script.

    Anyway. Basically you need 2 scripts. 1 that issues the commands and sets a global flag. And the onchat script that checks if you see the message and if the global flag is set. If so, do /sg messages again
     
    #4 kukelekuuk, Dec 10, 2016
    Last edited: Dec 10, 2016
  5. MaxToMinimum President
    President ⛰️⛰️ Ex-Tycoon ⚜️⚜️⚜️

    Joined:
    Dec 25, 2013
    Messages:
    1,225
    Trophy Points:
    24,860
    Gender:
    Male
    Ratings:
    +313
    Yeah, I tested it in a single player and because it is posting in chat, it just keeps on posting.
    Also, how would I set a global flag? I am quite new to macros and not good at programming them at all
     
  6. kukelekuuk C͕̹̲̽ͪ͐ͩ̔L̜̦̝͈ͦ̿̾̿ḘA̻̗̤̳̐ͭ̆̿̃̑ͭN̊̓͑̇ͯ
    Builder ⛰️ Ex-EcoLeader ⚜️⚜️⚜️ Premium Upgrade

    Joined:
    May 25, 2011
    Messages:
    10,061
    Trophy Points:
    80,160
    Ratings:
    +6,925
    global flags are basically booleans that are shared across all scripts. you can set a flag with SET(@<flagname>) and unset with UNSET(@<flagname>)
    the "@" part makes it global. Without the @ it can only be used in the same script.

    so say you name your flag sgmessages you get SET(@sgmessages) and UNSET(@sgmessages)
    They can be used in if statements. SET = true, UNSET = false. so like:
    Code:
    IF(@sgmessages);
    IFMATCHES(<regexstuff>);
    ENDIF;
    ENDIF;
     
    #6 kukelekuuk, Dec 10, 2016
    Last edited: Dec 10, 2016
  7. 314 Irrational SuperMod, former ServerAdmin
    SuperMod EcoLegend ⛰️⛰️⛰️⛰️ Ex-President ⚒️⚒️ Prestige ⭐ VI ⭐ Premium Upgrade

    Joined:
    Apr 1, 2014
    Messages:
    7,055
    Trophy Points:
    97,160
    EcoDollars:
    $2,400,000
    Ratings:
    +4,921
    Normally the "It may work, I haven't tested it yet" concept normally applies to all macros I post, but this time I was unable to test because Minecraft is crashing as soon as I start it due to graphics card issues.

    The script itself was supposed to be within an IF() block checking for a global flag, as you mentioned. If my script doesn't contain "$${ }$$", it usually means that it is only an extract that shouldn't be run as a standalone script; I acknowledge that I should have made this clear beforehand.

    A global flag is indicated by the use of '@' in front of its name.
    Set it to 'true':
    Code:
    SET(@flagname)
    
    Set it to 'false':
    Code:
    UNSET(@flagname)
    
    Conditional statement:
    Code:
    IF(@flagname)
    //Insert code here
    ENDIF
    
     
  8. MaxToMinimum President
    President ⛰️⛰️ Ex-Tycoon ⚜️⚜️⚜️

    Joined:
    Dec 25, 2013
    Messages:
    1,225
    Trophy Points:
    24,860
    Gender:
    Male
    Ratings:
    +313
    So I've spent like 45 minutes trying to figure out how to make this work, but I cannot figure it out.

    It would be lovely if any of you two could figure it out how to make it work, and actually show me how to do it. This is mainly as I am not as talented and knowledgeable in macros as you guys are.
    No rush, this isn't a need so take your time.
     
  9. kukelekuuk C͕̹̲̽ͪ͐ͩ̔L̜̦̝͈ͦ̿̾̿ḘA̻̗̤̳̐ͭ̆̿̃̑ͭN̊̓͑̇ͯ
    Builder ⛰️ Ex-EcoLeader ⚜️⚜️⚜️ Premium Upgrade

    Joined:
    May 25, 2011
    Messages:
    10,061
    Trophy Points:
    80,160
    Ratings:
    +6,925
    I haven't installed macromod in 2 years. So I won't be available for help.
     
  10. _Smokin S&S Constuction
    Builder ⛰️ Ex-Tycoon ⚜️⚜️⚜️ Premium Upgrade

    Joined:
    Jul 7, 2013
    Messages:
    141
    Trophy Points:
    43,370
    Ratings:
    +31
    First script bind to onChat Event.
    Code:
    $${
    IFMATCHES(%CHATCLEAN%, "^\[ECC-SG\] You will now receive SG broadcast messages.")
    IF(@sgmessage)
    ECHO("/sg messages")
    UNSET(@sgmessage)
    ENDIF
    ENDIF
    IFMATCHES(%CHATCLEAN%, "^\[Lottery\] You will now receive Lottery broadcast messages.")
    IF(@lotmessage)
    ECHO("/lot messages")
    UNSET(@lotmessage)
    ENDIF
    ENDIF
    }$$
    
    Second script bind to a key or gui button.
    Code:
    $${
    SET(@sgmessage)
    SET(@lotmessage)
    ECHO("/leave global")
    WAIT(1)
    ECHO("/leave local")
    WAIT(1)
    ECHO("/leave trade")
    WAIT(1)
    ECHO("/leave auction")
    WAIT(1)
    ECHO("/leave trv")
    WAIT(1)
    ECHO("/leave nether")
    WAIT(1)
    ECHO("/leave end")
    WAIT(1)
    ECHO("/leave mining")
    WAIT(1)
    ECHO("/leave vip")
    WAIT(1)
    ECHO("/leave sg")
    WAIT(1)
    ECHO("/sg messages")
    WAIT(1)
    ECHO("/lot messages")
    }$$
    
     
    #10 _Smokin, Dec 10, 2016
    Last edited: Dec 10, 2016
  11. MaxToMinimum President
    President ⛰️⛰️ Ex-Tycoon ⚜️⚜️⚜️

    Joined:
    Dec 25, 2013
    Messages:
    1,225
    Trophy Points:
    24,860
    Gender:
    Male
    Ratings:
    +313
    Thank you so much. It works
     
  12. kukelekuuk C͕̹̲̽ͪ͐ͩ̔L̜̦̝͈ͦ̿̾̿ḘA̻̗̤̳̐ͭ̆̿̃̑ͭN̊̓͑̇ͯ
    Builder ⛰️ Ex-EcoLeader ⚜️⚜️⚜️ Premium Upgrade

    Joined:
    May 25, 2011
    Messages:
    10,061
    Trophy Points:
    80,160
    Ratings:
    +6,925

    Should unset the global flags when the correct message shows up, too. The "no longer receive" messages.
     
  13. MaxToMinimum President
    President ⛰️⛰️ Ex-Tycoon ⚜️⚜️⚜️

    Joined:
    Dec 25, 2013
    Messages:
    1,225
    Trophy Points:
    24,860
    Gender:
    Male
    Ratings:
    +313
    Is that really necessary? I have used it fine in succession...
     
  14. kukelekuuk C͕̹̲̽ͪ͐ͩ̔L̜̦̝͈ͦ̿̾̿ḘA̻̗̤̳̐ͭ̆̿̃̑ͭN̊̓͑̇ͯ
    Builder ⛰️ Ex-EcoLeader ⚜️⚜️⚜️ Premium Upgrade

    Joined:
    May 25, 2011
    Messages:
    10,061
    Trophy Points:
    80,160
    Ratings:
    +6,925
    It's fine as long as you don't try to use the messages commands normally.