Page 1 of 2 12 LastLast
Results 1 to 25 of 27

Thread: A standard way of macro typing, please read on

  1. #1
    Join Date
    Jun 2007
    Location
    Canuckistan
    Posts
    306
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Arrow A standard way of macro typing, please read on

    Okay, I have noticed that scar (and just about every macroer out there, RS or not) doesn't have any really good format for typing out strings. I mean, we have SendKeysVB, however everyone knows that this format absolutely sucks and you cannot do anything useful with it.

    What I wanted was something that was simple, yet powerful enough to handle absolutely any problem, regardless of anything. The format I have created is very promising.

    Everything under this line has actually been implemented into my code. Look below for a pastebin link.

    First, let's say you just wanted to type out a simple string? Let's say the string was "runescape is awesome and i am not a cheater". Well, that is simple and can be done by anything out there.
    Some problems come in when you bring capitals into it, such as "RuneScape is AWESOME and I am not a cheater". This part is still simple, you just have the macro hold down shift for every capital letter.
    The third problem is with punctuation, such as an obligatory period at the end of that sentence ("RuneScape is AWESOME and I am not a cheater.") The way that the windows input commands work makes this almost impossible because the virtual keys do not map to ASCII (For an example, "." maps to 0xBE under windows virtual keys, however in ASCII it is actually 0x2E, a huge difference). It unfortunately isn't a matter of simply shifting the numbers down or up because they are not in order.
    My code (found at the bottom) is able to handle all of these, and plenty more.

    Let's say you wanted to use a shortcut that needed to use the CTRL key. Well, with the above examples that wouldn't work at all! That's where my next solution comes in. If you wanted to press, for example, CTRL+C, well you can simply input the string "[CTRL]c[/CTRL]" and it will do just that. You can even combine them, for example "[CTRL][ALT][SHIFT]A[/SHIFT[[/ALT][/CTRL]" (I don't know what that would do, however it would be pretty interesting.)

    Everything below this line is not actually implemented in my code however I believe they should be part of the macrotype, well, "standard".
    One possible problem with the special keys (keys enclosed in a [] tag) is that someone might just want to press a key and not combine it with anything, say maybe they only want to press the [F2] key and not have to use "[F2][/F2]". Well one way to make the strings look better would be to give another tag. my choice is "<F2>" so it will act just like any key. so with this you could do "[CTRL][ALT]<DELETE>[/ALT][/CTRL]" (however please don't do this, it'll make you look bad ).

    Now you've probably noticed I am missing the one really important thing in any macroing program: randomness. Well never fear, as I have my next solution: mini functions. say you wanted a delay of about 1 second between two sentences. In this case, we can do "This is one sentence.{delay: 1000ms}This is another sentence.". We can also use the syntax of {delay: 1s} to make things easier. This will allow any program to generate their own random numbers and input them as so. However why not put it directly into the syntax? "This is one sentence.{delay: 1s}{rdelay: 20ms}This is another sentence."

    Using these 3 tags shown above this syntax can have endless possibilities. Please discuss what you think about this idea, as I think it has great potential, and will make the job of scripting much much easier.


    Here's what you were looking for - my code!
    http://p.talkflack.com/index.php/view/63251790
    I am not putting any restrictions at all on this code or any macrotype code I make in the future. You are allowed to make your implementation proprietary if you really want, however I am keeping the description of the format completely open. Essentially everything I do related to macrotype is released into public domain.

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

    Default

    SCAR Code:
    KeyDown(VK_CONTROL);
    Wait(30 + random(30));
    TypeByte(GetKeyCode('v'));
    Wait(30 + random(30));
    KeyUp(VK_CONTROL);
    ??

  3. #3
    Join Date
    Jun 2007
    Location
    Canuckistan
    Posts
    306
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Da 0wner View Post
    Code:
    KeyDown(VK_CONTROL);
    Wait(30 + random(30));
    TypeByte(GetKeyCode('v'));
    Wait(30 + random(30));
    KeyUp(VK_CONTROL);

    ??
    The equivalent command in macrotype would be macrotype("[CTRL]{rdelay:30ms}v{rdelay:30ms}[/CTRL]",30);
    isn't that so much simpler?

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

    Default

    Sure. Could be replicated in SCAR though...

  5. #5
    Join Date
    Jun 2007
    Location
    Canuckistan
    Posts
    306
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Da 0wner View Post
    Sure. Could be replicated in SCAR though...
    definitely, however this makes it simpler and cleaner. And because it's written in C, it can be made into a DLL and used with scar which would create something much much faster than your code.

  6. #6
    Join Date
    Mar 2008
    Location
    New Jersey
    Posts
    1,673
    Mentioned
    1 Post(s)
    Quoted
    9 Post(s)

    Default

    I think the scar looks better, I don't like the way you had to write it in C, but I do really like your idea, good job, you should definitely finish this.

  7. #7
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    I think this is brilliant! Awesome idea!
    NxTitle, have you made this function in scar yet?

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

    Default

    Quote Originally Posted by Zyt3x View Post
    I think this is brilliant! Awesome idea!
    NxTitle, have you made this function in scar yet?
    Same!
    This is genious!
    <3, I think this is very smart.
    When are you going to add the second part?

    I didn't give the code a look already, but can you implant this in scar(ask freddy1990).
    ~Hermen

  9. #9
    Join Date
    Mar 2007
    Location
    Alberta, Canada
    Posts
    1,780
    Mentioned
    0 Post(s)
    Quoted
    11 Post(s)

    Default

    Quote Originally Posted by Zyt3x View Post
    I think this is brilliant! Awesome idea!
    NxTitle, have you made this function in scar yet?
    I think it's a great idea too, and should be added to scar.

  10. #10
    Join Date
    Jun 2007
    Location
    Canuckistan
    Posts
    306
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I have posted it on Freddy1990's forum and there has been no reply (although it's only been there for like an hour so I don't expect him to so quickly)

    I really hope that Freddy can implement something like this into SCAR, however if he doesn't accept then I can always make it into a DLL and distribute it.

  11. #11
    Join Date
    Feb 2006
    Posts
    3,044
    Mentioned
    4 Post(s)
    Quoted
    21 Post(s)

    Default

    Quote Originally Posted by NxTitle View Post
    I have posted it on Freddy1990's forum and there has been no reply (although it's only been there for like an hour so I don't expect him to so quickly)

    I really hope that Freddy can implement something like this into SCAR, however if he doesn't accept then I can always make it into a DLL and distribute it.
    Blah i feel so stupid ( Probaly because my lack of English ) But i didn't understand : /
    Could you make simple little explanation

    ~Home

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

    Default

    I have already made a similar function like this I'll post it for you guys when I get home.



    ~NS

  13. #13
    Join Date
    Jun 2007
    Location
    Canuckistan
    Posts
    306
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Home View Post
    Blah i feel so stupid ( Probaly because my lack of English ) But i didn't understand : /
    Could you make simple little explanation

    ~Home
    Don't worry, I know I made that really wordy. Someone else even said tl;dr for it, lol.

    Okay, so basically it lets you send a string of keys to runescape.
    it ranges from as simple as "This is rs." to "[SHIFT]t[/SHIFT]his is {delay:20ms} rs."
    or even things like "[CTRL][ALT]<DELETE>[/ALT][/CTRL]"

    the way the syntax works is this:
    anything not in a tag ( tags are enclosed in [], {} or <> ) will be typed the way it is seen.
    anything in [] tags are keydown or keyup. For example, typing [CTRL] will push the CTRL key down, and [/CTRL] will release it again.
    anything in <> tags are special keys that are just pressed. For example, <CTRL> will press CTRL then release it, just like it was any other key.
    anything in {} is a mini function. Basically I wanted to put this in for custom delays. The two functions I have planned for this are "delay" and "rdelay". delay just sleeps for the amount of time given, and rdelay sleeps for a random amount between the amount of time given and 0ms so you can combine them as well. For example, if you wanted a random amount between 30ms and 60ms, you can do "{delay:30ms}{rdelay:30ms}"

    hopefully that helped.

  14. #14
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    2,851
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    I think it's a major drawback in SRL not to be able to write those special chars.
    If this works as you say, it definetly should be added to SRL.

    Can't the randomness be handled like
    TypeThis('Hi, my name is Bob!.,#', 200+random(100));
    like in pascal
    Last edited by marpis; 07-14-2009 at 12:27 PM.

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

    Default

    I wrote this in SCAR, a simple and crappy version .

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

    Default

    Quote Originally Posted by Da 0wner View Post
    I wrote this in SCAR, a simple and crappy version .
    lol yea, I have a kinda simple one too, as I've said, I'll post it as soon as I get home, like by tomorrow or something. The one I made is used like this:

    Code:
    TypeSmart('<wait>$n</wait><shift>$n</shift>$n<space/>$n', [2000, 'H', 'i, testing', 'spaced!'])




    ~NS

  17. #17
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    Quote Originally Posted by marpis View Post
    Can't the randomness be handled like
    TypeThis('Hi, my name is Bob!.,#', 200+random(100));
    like in pascal
    The script would not be able to know where the wait should be added, and what if you wanted to wait in two different periods?

  18. #18
    Join Date
    Feb 2006
    Posts
    3,044
    Mentioned
    4 Post(s)
    Quoted
    21 Post(s)

    Default

    Quote Originally Posted by NxTitle View Post
    Don't worry, I know I made that really wordy. Someone else even said tl;dr for it, lol.

    Okay, so basically it lets you send a string of keys to runescape.
    it ranges from as simple as "This is rs." to "[SHIFT]t[/SHIFT]his is {delay:20ms} rs."
    or even things like "[CTRL][ALT]<DELETE>[/ALT][/CTRL]"

    the way the syntax works is this:
    anything not in a tag ( tags are enclosed in [], {} or <> ) will be typed the way it is seen.
    anything in [] tags are keydown or keyup. For example, typing [CTRL] will push the CTRL key down, and [/CTRL] will release it again.
    anything in <> tags are special keys that are just pressed. For example, <CTRL> will press CTRL then release it, just like it was any other key.
    anything in {} is a mini function. Basically I wanted to put this in for custom delays. The two functions I have planned for this are "delay" and "rdelay". delay just sleeps for the amount of time given, and rdelay sleeps for a random amount between the amount of time given and 0ms so you can combine them as well. For example, if you wanted a random amount between 30ms and 60ms, you can do "{delay:30ms}{rdelay:30ms}"

    hopefully that helped.
    Yes! Now i got it! And i think this is a great addition to scar!

    ~Home

    P.S Good Job!

  19. #19
    Join Date
    Jun 2007
    Location
    Canuckistan
    Posts
    306
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by marpis View Post
    I think it's a major drawback in SRL not to be able to write those special chars.
    If this works as you say, it definetly should be added to SRL.

    Can't the randomness be handled like
    TypeThis('Hi, my name is Bob!.,#', 200+random(100));
    like in pascal
    that wouldn't end up the way you would want it to. So I had an idea for that.

    first, we could have a second parameter for the randomness, such as
    macrotype("Hi, my name is Bob!.,#',200,100)
    or -1 for no randomness.

    I just didn't want to put it into C because it is notorious for having a really shitty random number generator.

    And yes, it supports every symbol on my keyboard, which is a US layout. I would need more people from different places to add in the british pound and euro symbols, etc.
    Last edited by NxTitle; 07-15-2009 at 03:16 AM.

  20. #20
    Join Date
    Feb 2006
    Location
    Belgium
    Posts
    3,137
    Mentioned
    3 Post(s)
    Quoted
    5 Post(s)

    Default

    Quote Originally Posted by marpis View Post
    I think it's a major drawback in SRL not to be able to write those special chars.
    If this works as you say, it definetly should be added to SRL.
    I'm working on a sendkeys function that can send special characters... Also going to write one to do what this one does, i like the idea

  21. #21
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    http://delphi.about.com/od/adptips20...ltip0604_4.htm



    And just use PostKeyEx32 just a normal KeyDown & KeyUp
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

  22. #22
    Join Date
    Feb 2006
    Location
    Belgium
    Posts
    3,137
    Mentioned
    3 Post(s)
    Quoted
    5 Post(s)

    Default

    Quote Originally Posted by Dan's The Man View Post
    http://delphi.about.com/od/adptips20...ltip0604_4.htm



    And just use PostKeyEx32 just a normal KeyDown & KeyUp
    I'm using the SendInput api like nxtitle, it's quite interesting, never actually heard of it, but it allows for much more control than keyb_event, though I suppose the keyb_event api is based on it.

    I'm probably going to toss out the current SendKeys function and replace it with mine, it's uses delays and stuff so it's as safe to use as TypeSend.
    Last edited by Freddy1990; 07-16-2009 at 05:21 PM.

  23. #23
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    Quote Originally Posted by Freddy1990 View Post
    I'm using the SendInput api like nxtitle, it's quite interesting, never actually heard of it, but it allows for much more control than keyb_event, though I suppose the keyb_event api is based on it.

    I'm probably going to toss out the current SendKeys function and replace it with mine, it's uses delays and stuff so it's as safe to use as TypeSend.
    Isn't that what SendKeysWait is for though? And some people still like to use the current SendKeys (instantaneous typing) in things (like me)
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

  24. #24
    Join Date
    Feb 2006
    Location
    Belgium
    Posts
    3,137
    Mentioned
    3 Post(s)
    Quoted
    5 Post(s)

    Default

    Quote Originally Posted by Dan's The Man View Post
    Isn't that what SendKeysWait is for though? And some people still like to use the current SendKeys (instantaneous typing) in things (like me)
    SendKeysWait is a disaster, propably one of the first ones to go in SCAR 4, lol. I've finished the new SendKeys functions, it doesn't have delays like before, but it can type a whole lot more stuff, including the characters 161-255, it can't type all special characters, but it can type most of them. I've also added a second function, TypeKeys, which is the same functions, but with the delays, making it as safe to use as TypeSend in SRL. I'm still tweaking it a tad-bit here and there, but it works great.

    The functions support these characters:
    9-10, 13, 20-126, 128, 161-255

    (10 does a return same as 13, 10 is the line feed character)
    Last edited by Freddy1990; 07-16-2009 at 08:43 PM.

  25. #25
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    Will it also work for localized keyboards? @ for example; some people need to do ALT GR (Right Alt) + 2 instead of SHIFT + 2.

Page 1 of 2 12 LastLast

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
  •