Jump to content
Macro Express Forums

Mmpg Macro - Tradeskilling


Recommended Posts



Just downloaded the program and am frantically trying to read the instructions whilst typing this so please forgive my eagerness!


I would really like to be able to use this program to perform several functions which I will try and outline below - if anyone can please point me in the direction of past forum posts I would be sincerely grateful.


The basic structure of what I am trying to do (please note, I would prefer to write the entire function in script if possible) is:


1 - Start

2 - Delay by a set time variable - say 5 seconds

3 - Press a key at a set of co-ords after a randomised time (say 3.5s +/- random time between 1 and 7s)

4 - Press a series of keys each being interspaced by a random amount of time - say key #1, wait 2s +/- random time between 1s and 3s, press key #2 + random time, press #3 etc etc

5 - Before each press of the key #, check the colour of a pixel at a set of co-ords - depending on the colour of this / these pixels (lets call these events) choose from 1 of 4 actions (like a select case?) if pixel = nothing, then keep pressing the keys as per step 4, if pixel = say green, press key #2, if it's blue press #3 etc etc - this part may be a bit of a loop in that before each key press it would have to check the colour of the pixels


So what I would have here is a simple pattern of key presses (i.e., 1, random pause, 2, random pause, 3, random pause) but possibly being interspaced with additional key strokes depending on the colour (events) of a set of pixels - so it might be something like:

(check pixel - no event press 1, check pixel - no event press 2, check pixel - event 2 therefore press 1, check pixel - no event press 3, then go back to the start again)


6 - keep looping through the key presses (1,2,3) making sure to react to the events (the pixel colours) if they are detected - once, another set of pixels is a certain colour, then stop, pause, check the colour of a set of pixels, if ok, then start again after a random time else keep pausing till the pixels are are acceptable colour


Preferrably all random time is measured in parts of time - by this I mean, not whole intergers - for example, if the variable was 5 seconds +/- random 3 seconds - that could mean 'do the event any time between 2 and 8 seconds including parts of seconds


Ok...so by now your sitting there scratching your head saying 'what the hell is this guy doing?!?!?' well..pretty simple really, some of you may have guessed already - I love MMPGs (multiplayer games), played them for many years now - the problem is, most of these MMPGs require a character to have tradeskills - that is basically what I wish to use this application for


So...to convert what I have just mentioned above into what I would be seeing if I were looking at the game now:

1 - hit the start icon to commence the trade action

2 - I need to press my buttons 1,2,3 (which are buffs - i.e., makes the item created better) BUT I also have to react to 'events' which the program randomly throws up to make sure I am awake - so I might have to press the number 1 as fast as I can or I blow up

3 - I keep doing this till I have finished making what the shield or whatever - then I look at my health bar, sometimes, if I was too slow to react to the events, I get damaged - therefore it would be a good idea if I just kept waiting till my health came back up before I started again

4 - redo it all again - repeat 100000000000000 times - congratulations you are now a legendary grand master of thingy making! /the crowd cheers


So in summary I would sincerely appreciate being directed to any posts which covers:

- randomising the time between key presses (so my character looks human even though I am asleep at the time!)

- checking the colour of a pixel

- select case function whereby depending on the colour of a pixel a variety of actions can occur


Any ideas? :)


...and let the flaming begin!

Link to comment
Share on other sites

Welcome to the forum ... er, Obnoxious


Going by your summary at the end, here is a sample macro that delays a random amount of time (between 1/1000th of a second and 7 seconds) then types the delayed time into Notepad. One millisecond = 1/1000th of a second, so this should satisfy your need for partial seconds. It loops 10 ten times. You can copy and paste the second part of the code directly into a macro and test it. Make sure that you do not mistakenly grab any CR/LF characters. The top half of the code is what it should look like in your macro.

Activate or Launch: "Notepad" OR "notepad.exe"
Wait For Window Title: "Notepad"
Repeat Start (Repeat 10 times)
 Variable Set Integer %N1% with a Random Number
 Delay %N1% Milliseconds
 Text Type: %N1%<ENTER>
Repeat End



The following code demonstates how to grab a pixel color and then test it in a Switch/End Switch construct. Change the coordinates to anything you wish. You can use the built-in Mouse Locator tool to get the pixel color underneath the mouse pointer.

Get Pixel: Screen Coords: 785,105 into %N1%
Switch (N1)
 Case: 0
   Variable Set String %T1% "BLACK"
 End Case
 Case: 16777215
   Variable Set String %T1% "WHITE"
 End Case
 Case: 255
   Variable Set String %T1% "RED"
 End Case
 Case: 32768
   Variable Set String %T1% "GREEN"
 End Case
 Case: 16711680
   Variable Set String %T1% "BLUE"
 End Case
 Case: 65535
   Variable Set String %T1% "YELLOW"
 End Case
 Case: 8421504
   Variable Set String %T1% "GREY"
 End Case
 Case: 26367
   Variable Set String %T1% "ORANGE"
 End Case
 Default Case
   Variable Set String %T1% "UNDETERMINED"
 End Case
End Switch
Text Box Display:

<GETPX:1:S:000785:000105><SWITCH:N1><CASE:0><TVAR2:01:01:BLACK><ENDCASE><CASE:16777215><TVAR2:01:01:WHITE ><ENDCASE><CASE:255><TVAR2:01:01:RED ><ENDCASE><CASE:32768><TVAR2:01:01:GREEN ><ENDCASE><CASE:16711680><TVAR2:01:01:BLUE ><ENDCASE><CASE:65535><TVAR2:01:01:YELLOW ><ENDCASE><CASE:8421504><TVAR2:01:01:GREY ><ENDCASE><CASE:26367><TVAR2:01:01:ORANGE ><ENDCASE><DEFCASE><TVAR2:01:01:UNDETERMINED ><ENDCASE><ENDSWITCH><TBOX4:T:4:CenterCenter000170000110:000: Color is %T1%>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...