Results 1 to 16 of 16

Thread: InterSCARMessages

  1. #1
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default InterSCARMessages

    Haider, this is going to be a super short and to the point tutorial. These are pretty easy so that is why it is in the beginners section.

    InterSCARMessages are basically messages that can be read and sent throughout every SCAR on the same computer. They are sent over different "channels". Each channel can hold a different message.

    There are a few functions you should know about.
    SCAR Code:
    SendInterSCARMessage(ID, Message : string) : boolean;

    This function sends the message over the channel ID. There are also different ones like SendInterSCARBoolean (etc.) and those are pretty straight forward.

    SCAR Code:
    ReadInterSCARMessage(ID : string) : string;

    This function reads the message residing in the channel ID. It returns the string.

    Now that is basically really all that you need to know.

    But one thing, after you read the message, you should send a message back to the same channel that is blank so that it does not read it again.

    Please post, PM me, or add me on MSN (kylewollaston@hotmail.com) if you need help.

    You can also look in AppPath + 'Scripts\Test\InterSCARMessageTest.scar', AppPath + 'Scripts\Test\Command_Plane.scar' and AppPath + 'Scripts\Test\Command_Tower.scar'.

    Those are some examples. I decided to write this because of http://www.villavu.com/forum/showthread.php?t=45800. One example is what I posted there (my third post).

  2. #2
    Join Date
    Nov 2008
    Location
    Melbourne, Australia
    Posts
    2,240
    Mentioned
    3 Post(s)
    Quoted
    11 Post(s)

    Default

    Looks very nice
    Click here to find out how to get full screen without members! | Click here to check out my Ultimate Bitmap Tutorial! Edited to work with Simba! |

  3. #3
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    so, what would this be used for? like, if you where running multiple scripts at a time, and you use sendinterscar to give them(or specific) code, which can be translated to a command? like

    SCAR Code:
    if (ReadInterSCARMessage('lol') = 'Stop') then terminatescript;
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  4. #4
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yes, you could do that, akwardsaw. You could also just have something running on the script that's autoing like if(IsFKeyDown(2))then blahblahblah; You know? (Open up a Readln, then TypeSend that).

  5. #5
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yes, but make sure you clear the channel after doing the command.

  6. #6
    Join Date
    Dec 2008
    Location
    In a galaxy far, far away...
    Posts
    584
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Nice tut Rep++!

    You should throw in a sample code though, with how to clear the channels.



    ~NS

  7. #7
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    SendInterSCARMessage(CHANNEL, '');


    Edit: Wtf, who moved this to super advanced -_-.

  8. #8
    Join Date
    Jun 2007
    Location
    Wednesday
    Posts
    2,446
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    I usually prefer to send a boolean through ISM to say whether or not to run a command. I like it since it makes it more structured as it's much easier to do "if ReadBool then" than "if ReadMess <> '' then". Doesn't really do much more apart from that, but I like it that way
    By reading this signature you agree that mixster is superior to you in each and every way except the bad ways but including the really bad ways.

  9. #9
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    For example you could have a repeat loop on receiving some message from a server(Stop Signal) then you can use this, and then terminate script in the main script! Not like RC that you have to wait 5 mins...
    ~Hermen

  10. #10
    Join Date
    Sep 2006
    Location
    New Jersey, USA
    Posts
    5,347
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by Da 0wner View Post
    Edit: Wtf, who moved this to super advanced -_-.
    Ditto.
    Interested in C# and Electrical Engineering? This might interest you.

  11. #11
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I asked Chris and he said Zeph moved it to advanced, then RM moved it here.

  12. #12
    Join Date
    Sep 2006
    Location
    New Jersey, USA
    Posts
    5,347
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    RM, WHY? *dies*
    Interested in C# and Electrical Engineering? This might interest you.

  13. #13
    Join Date
    Jan 2007
    Posts
    15
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    When invoking the command "SendInterSCARMessage" can someone tell me how to make the dialog box pop up in front of the smart window? It always appears behind my open windows.

    I'm thinking of something like 'ShowModal' or do I have to create a form for input? I'm new to SCAR coding but am enjoying it.

  14. #14
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by jnewman View Post
    When invoking the command "SendInterSCARMessage" can someone tell me how to make the dialog box pop up in front of the smart window? It always appears behind my open windows.

    I'm thinking of something like 'ShowModal' or do I have to create a form for input? I'm new to SCAR coding but am enjoying it.
    Hi there, you need to do: GetApplication.BringToFront;, before you call the pop-up to appear .

  15. #15
    Join Date
    Jan 2007
    Posts
    15
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thank you kindly, I'll give it a crack :-)

  16. #16
    Join Date
    Sep 2008
    Posts
    194
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    I know this is a year old topic, but I figured out something that may make it easier for others to understand. It makes it easier for me to understand at least.

    The ScarInterMessages can be treated as "Global Variables", in a sense that, the channel name would be the variable and the other part of it would be the value of the variable.

    That's the concept I understand it to be... I figure it would be more effective be simply be able to estable global variables at the top of the script where you establish your normal vars. With these scarintermessages you can send strings, numbers, and booleans, but they all need to be converted to a string to be sent/'stored'.

    If a "Global Variable" feature was implemented then we could do things like have global TPAs etc.

    It's one thing for scripts to send messages, but imagine if we could make 2 scripts co-operate and use Global TPAs. I'm not aware of any actual uses other then pure scripting fun, but I know various uses would show them selfs as time progresses.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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