Janilabo Posted December 10, 2012 Share Posted December 10, 2012 (edited) Introduction to MSSL's useful Project RSC stuff! Example script skeleton: {$DEFINE PRSC} {$I MSSL\MSSL.scar} procedure ScriptTerminate; begin MSSL_Unsetup; end; // Place your procedures & functions here begin MSSL_Setup; // Place your main loop stuff here end. NOTE: This introduction/documentation is based on MSSL 0.99-36(+). Login function PRSC_LoggedIn: Boolean; -This function returns True if our character is logged in to Project RSC, else the result will be False. function PRSC_AtLogin: Boolean; -This function returns True if we are at Login page, it's the page that contains New User & Existing User options. Image of Login page function PRSC_AtLoginNewUserPage: Boolean; -This function returns True if we are at New User page of Login. Image of New User page function PRSC_AtLoginDetails: Boolean; -This function returns True if we are at Login Details, the page with Username and Password fields. Image of Login Details page function PRSC_AtLoginScreen: Boolean; -This function returns True if we are at any of the Login screen pages (Login, New User, Details). function PRSC_GetLoginMessage: string; -This function returns the current message of Login Details page as string. List of Messages below! -Please wait... Connecting to server -That username is already logged in. Wait 60 seconds then retry -Sorry! Unable to connect. Check internet settings or try another world -Invalid username or password. Try again, or create a new account -Account banned. Appeal on the forums, ASAP -Please enter your username and password function PRSC_SetLoginDetails(username, password: string): Boolean; -This function sets your character's Username and Password to Login Details page. NOTE: This works ONLY if your character is at Login Details page! Returns True with success. function PRSC_LogIn(username, password: string): Boolean; -This function login's with Username and Password. NOTE: Doesn't matter which Login page you have open, as long as you are logged out of game! Function is fully failsafed. Returns true with success. If you have set incorrect user details, this function will set PRSC_InvalidUserDetails variable to True after certain amount of tries (3 = default) If your character has been banned, this function will set PRSC_Banned variable to True. function PRSC_LogOut: Boolean; -This function logs out of game. Returns true with success (keeps trying for up to 2 minutes)! procedure PRSC_QuickLogOut; -This procedure tries to log out of game quickly (ONLY 1 time!) Contains no failsafes, pretty much. GameTab Image of GameTab function PRSC_GameTabOpen(i: Integer): Boolean; -This function returns True if tab (i) from GameTab is open (as in, active). List of tab constants below. PRSC_GAMETAB_OPTIONS = 0; PRSC_GAMETAB_FRIENDS = 1; PRSC_GAMETAB_SPELLS = 2; PRSC_GAMETAB_STATS = 3; PRSC_GAMETAB_MAP = 4; PRSC_GAMETAB_INVENTORY = 5; function PRSC_OpenGameTab(i: Integer): Boolean; -This function opens GameTab tab. Will move mouse to the game tab, but if it doesn't succeed with it, it will try with forcing after 3 fails. Returns true with success. Image of GameTab items with ID's function PRSC_ForceOpenGameTab(i: Integer): Boolean; -This function does the same thing as PRSC_OpenGameTab(), with small exception, that this keeps trying to force open all the time. Forcing is required if you have say... Message boxes open (example: private messaging). Returns true with success. procedure PRSC_QuickOpenGameTab(i: Integer); -This procedure performs a quick mouse movement to game tab (i). Contains no failsafes! Small note: Works quickly (but you need to add failsafes/checks yourself). procedure PRSC_QuickOpenGameTab(i: Integer); -This procedure performs a quick mouse click to game tab (i). Contains no failsafes! Small note: Works quickly (but you need to add failsafes/checks yourself). function PRSC_ActiveGameTab: Integer; -This function returns the currently open/active game tab as integer (ID). Returns -1 if none of the tabs are open. function PRSC_GameTabInUse: Boolean; -This function returns true if ANY of the game tabs are open/active (in use!) Map function PRSC_MapOpen: Boolean; -This function returns true if Map (minimap) is open. function PRSC_OpenMap: Boolean; -This function open's Map (minimap). Nicely failsafed, forcing after few fails. Returns true with success. function PRSC_ForceOpenMap: Boolean; -This function does the same as function above, except that this uses force to open it! Returns true with success. procedure PRSC_QuickOpenMap; -This procedure quickly tries to open Map with simple mouse movement. NOTE: Contains no failsafes. procedure PRSC_QuickForceOpenMap; -Same as the procedure above, but with mouse click as forcing. NOTE: Contains no failsafes. procedure PRSC_RotateCamera(rotate: PRSC_TRotateCameraDirection); -This procedure is used for Camera/Compass rotating. Uses PRSC_TRotateCameraDirection type for direction. NOTE: This keeps rotating the camera until you stop it with rcd_Nil (..or with VKeyUp(VK_LEFT) / VKeyUp(VK_RIGHT)) Directions below. -rcd_Nil (stops the camera rotation) -rcd_Left (rotates camera at left, anticlockwise) -rcd_Right (rotates camera at right, clockwise) -rcd_Random (rotates camera to either left or right - RANDOMLY) Image for showing the rotating direction "rcd_Left" Image for showing the rotating direction "rcd_Right" function PRSC_GetCameraAngle: Extended; -This function returns the current Camera angle as degrees, 0.0 => 360.0. Checks minimap to get the result. Image displaying N, S, E, W, NE, NW, SE, SW angle degrees function PRSC_SetCamera(dgrs: Extended): Boolean; -This function sets camera/compass to angle by dgrs. Returns true with success. NOTE: Do NOT include that "°" to dgrs extended! You'll get an error if you do. The dgrs can be anything from 0.0 to 360.0.. Well, it can be higher aswell, as it will be then auto-corrected by function to range of 0-360. var PRSC_MinimapBx: TBox; This variable contains the Map area stored to TBox (as X1, Y1, X2, Y2 coordinates). PRSC_MinimapBx := Box(353, 36, 508, 187); function PRSC_MMPlayerMoving: Boolean; -This function returns true if our character is moving in minimap. NOTE: The scan takes about 300-500 milliseconds (interval between PixelShift checks is 300 ms.) Text function PRSC_MatchText(correctText, checkText: string): Boolean; -With this functions we can match text (checkText) that we have captured from Project RSC [GetTextAt(Ex)], with our text (correctText). NOTE: Reason for this function is because, in RuneScape Classic letter "I" (uppercase i) is IDENTICAL (pixel by pixel!) with letter "l" (lowercase L) Example: PRSC_MatchText('love', 'Iove') returns TRUE. function PRSC_MatchTextEx(correctText: string; checkTexts: TStrArray): Boolean; -With this function we can check if ANY of the checkTexts' strings matches our correctText. Returns true if at least 1 of em matches. Deals with "I" vs. "l" problem. procedure PRSC_FixText(var text: string; method: PRSC_TTextMethod); -This procedure tries to fix captured text. NOTE: This is NOT perfect, not at all, but still does the job OK. Really useful for logging / debugging purposes mostly. Deals with "I" vs. "l" problem. PRSC_TTextMethod's listed below. -tm_PlayerName (performs fix based on Player Name) -tm_PlayerText (performs fix based on Player Text) -tm_GameName (performs fix based on Game Name (NPCs) -tm_GameText (performs fix based on Game Text - Questing, banking, etc...) procedure PRSC_FixTextEx(var TSA: TStrArray; method: PRSC_TTextMethod); -Nearly same with procedure above, but this fixes an array of texts (TSA)! function PRSC_TextsAtEx(X, Y: Integer; texts: TStrArray; colors: TIntArray): Boolean; -This function returns true if ANY of texts with color from colors TIntArray is at X, Y coordinates. NOTE: Based on PRSC_MainFont. function PRSC_TextAtEx(X, Y: Integer; text: string; colors: TIntArray): Boolean; -This function returns true if single text with color from colors TIntArray is at X, Y coordinates. NOTE: Based on PRSC_MainFont. function PRSC_TextsAt(X, Y: Integer; texts: TStrArray; color: Integer): Boolean; -This function returns true if ANY of texts with color are at X, Y coordinates. function PRSC_TextAt(X, Y: Integer; text: string; color: Integer): Boolean; -This function returns true if text with color is at X, Y coordinates. function PRSC_UpText: string; -This function returns current up text (the text at top-left corner). Image of UpText function PRSC_UpText2: string; -This function does the same as PRSC_UpText, returns upper text, but using different methods to detect/get the text. Use the one that feels/works better for your needs. function PRSC_IsUpText(str: string): Boolean; -Returns true if UpText matches str. Not case-sensitive. UpText must start with this str. function PRSC_UpTextContains(s: string): Boolean; -Returns true if UpText contains our string (s). Not case-sensitive. function PRSC_UpTextContainsEx(TSA: TStrArray): Boolean; -Returns true if UpText contains ANY of the strings in TSA. Not case-sensitive. function PRSC_ChooseOptionInUse(var x, y: Integer): Boolean; -Returns true AND stores X, Y coordinates to x, y, if Choose Option is in use (available/shown at screen). Image of Choose Option function PRSC_ChooseOptionAvailable: Boolean; -Returns true if Choose Option is in use (available/shown at screen). function PRSC_ChooseOptionItems: TStrArray; -Returns ALL of the items from Choose Option menu as an TStrArray (array of string). function PRSC_ChooseOptionUse(name: string): Boolean; -Uses Choose option by name, must not be full name, but Choose Option item must AT LEAST start with the name. Returns true with success. Case-sensitive! -Example way to use this function: PRSC_ChooseOptionUse('Attack Chicken'); (See, no level used, but this works great!) function PRSC_ChooseOptionTarget: Integer; -Returns the currently selected/targeted item from Choose Option menu, as integer (list index). List index starts with 0. If this function fails, the result will be -1 (eg. Choose Option is/was not in use) Image showing the Choose Option Target "Attack Chicken..." (target: 2) function PRSC_DisableChooseOption: Boolean; -Disables (closes) the Choose Option (if its available) using right click to "Choose Option"-title. NOTE: NOT recommended to use this in any scripts where combat is involved. Returns true with success. Failsafed. procedure PRSC_QuickDisableChooseOption; -Quickly tries to close Choose Option. Does not contain any failsafes. function PRSC_SelectionItems: TStrArray; -Returns all the items from Selection as array of string (TStrArray). Selection items are text selections at top-left corner. Examples: "I'd like to access my bank account please" AND "What is this place?" (from Banker) Image of Selection function PRSC_SelectionItemUse(name: string): Boolean; -Uses item by name from Selection, if Selection is available. Full name isn't required, but the Selection item must at least start with name. Case-sensitive! Returns true with success. function PRSC_SelectionItemTarget: Integer; -Returns the currently selected item target from Selection as integer (0-11). If this function fails, the result will be -1 (eg. Selection isn't even available!). Image showing the Selection Item Target "What is this..." (target: 1) function PRSC_ChatbarText: string; -Returns the current text we have typed to chatbar. procedure PRSC_QuickClearChatbar; -Clears chatbar. procedure PRSC_QuickClearChatbar; -Clears chatbar, quick! function PRSC_GetActiveChatTab: Integer; -Returns the current active chat tab as integer. Result will be -1 without success.. Failsafed. function PRSC_GetActiveChatTabQuick: Integer; -Returns the current active chat tab as integer. NOT failsafed. Result will be -1 without success. function PRSC_GetChatLineEx(line, color: Integer): string; -Returns the chatline text from line (0-4) by color (-1 for ANY color). NOTE: This function doesn't pay attention to the "I" vs. "l" OCR problem. So, it is highly recommended to use combination of this and PRSC_FixText(). Image showing Chat Lines - "J N L B: A" = 0, "J N L B: Ab" = 1, "Sorry, you..." = 2, "The Goblin..." = 3. function PRSC_GetChatLine(line: Integer): string; -Returns the chatline with ANY color. NOTE: This function doesn't pay attention to the I vs. l OCR problem either. function PRSC_IsChatLineEx(line, color: Integer; text: string): Boolean; -Returns true if the text at chatbox line IS or STARTS WITH text. Using -1 to color part makes it check for text with any color. function PRSC_IsChatLine(line: Integer; text: string): Boolean; -Returns true if the text at chatbox line IS or STARTS WITH text. Based on all colors. Combat var PRSC_CombatStyle: Integer; -Stores the combat style as integer, this is used in PRSC_Wait() for making sure we got the correct style in use. So, make sure you set this variable to combat style you want to use! List of Combat Style ID's below. PRSC_COMBAT_STYLE_CONTROLLED = 0; PRSC_COMBAT_STYLE_MULTI = PRSC_COMBAT_STYLE_CONTROLLED; PRSC_COMBAT_STYLE_AGGRESSIVE = 1; PRSC_COMBAT_STYLE_STRENGTH = PRSC_COMBAT_STYLE_AGGRESSIVE; PRSC_COMBAT_STYLE_ACCURATE = 2; PRSC_COMBAT_STYLE_ATTACK = PRSC_COMBAT_STYLE_ACCURATE; PRSC_COMBAT_STYLE_DEFENSIVE = 3; PRSC_COMBAT_STYLE_DEFENSE = PRSC_COMBAT_STYLE_DEFENSIVE; function PRSC_InFight: Boolean; -Returns true if we area in fight/battle/combat. Based on combat style box. Image displaying Combat (PRSC_InFight = TRUE) function PRSC_GetCombatStyle(var style: Integer): Boolean; -If we are in battle, this stores the currently used combat style as integer to style. Returns true with success (when/if we got the style!). function PRSC_SetCombatStyle(style: Integer): Boolean; -If we are in battle, this will set the chosen combat style (style). Returns true with success - if style was set. function PRSC_GetWildernessLevel: Integer; -Returns the wilderness level as integer. If the level text is covered by chatbox text, this will return -1. ..and if we are outside wilderness, this returns as 0 (obviously). Edited December 10, 2012 by Janilabo Quote Link to comment Share on other sites More sharing options...
Janilabo Posted December 10, 2012 Author Share Posted December 10, 2012 (edited) Inventory function PRSC_InventoryOpen: Boolean; -Returns true if Inventory tab is open. function PRSC_OpenInventory: Boolean; -Opens Inventory - based on PRSC_OpenGameTab(). Returns true with success. function PRSC_ForceOpenInventory: Boolean; -Force opens Inventory - based on PRSC_ForceOpenGameTab(). Returns true with success. procedure PRSC_QuickOpenInventory; -Quickly opens Inventory - based on PRSC_QuickOpenGameTab(). NOT failsafed. procedure PRSC_QuickForceOpenInventory; -Quickly opens Inventory by force - based on PRSC_QuickForceOpenGameTab(). NOT failsafed. const PRSC_INVENTORY_* (Area coordinates for whole inventory area) PRSC_INVENTORY_X1 = 264; PRSC_INVENTORY_Y1 = 35; PRSC_INVENTORY_X2 = 508; PRSC_INVENTORY_Y2 = 239; function PRSC_GetInventorySlot(id: Integer): TBox; -Returns the inventory slot bounds (as TBox) by slot ID (id, 0-29). Image displaying Inventory slot bounds function PRSC_PointToInventorySlot(p: TPoint): Integer; -Converts the coordinates (p) to inventory slot. Returns -1, if p is not inside any of slots. function PRSC_GetInventorySlotID(R, C: Integer): Integer; Returns the Inventory slot ID by row ® and column ©. Image shows Inventory rows (r*) and columns (c*) Image shows Inventory slot ID's Item function PRSC_LoadItemImage(ID: Integer): Boolean; -Loads bitmap data of Project RSC item (ID) to memory (PRSC_Items). It's good to load all items that you will be checking (very) often, such as foods. There will be less loading/freeing (saves time!) that way. Returns true with success. procedure PRSC_LoadItemImages(IDs: TIntArray); Loads bitmap data of Project RSC items (IDs) to memory (PRSC_Items). procedure PRSC_UnloadItemImage(ID: Integer); -Unloads (free's) bitmap data of Project RSC item (ID) from memory (PRSC_Items). procedure PRSC_UnloadItemImages(IDs: TIntArray); -Unloads (free's) bitmap data of Project RSC items (IDs) from memory (PRSC_Items). function PRSC_GetItemTPA(ID: Integer): TPointArray; -Returns all the points (pixels) of an item (by ID) that aren''t color 0 (black). function PRSC_ItemAtInventorySlot(ID, inventory_index: Integer): Boolean; -Returns true if item (by ID) is at slot by inventory_index (0-29). function PRSC_GetInventorySlotsWithItem(var inv_slots: TIntArray; ID: Integer): Boolean; -Stores all the inventory slots, where item (ID) can be found, to inv_slots. Returns true if function succeeds at scanning the inventory for items. function PRSC_GetItemID(name: string): Integer; -Converts item name to ID. Not case-sensitive. Returns -1 if name is incorrect. function PRSC_GetInventoryItemCount(slotID: Integer): Integer; Returns the count of inventory item by slot ID. Result will be -1 if slot is empty. Edited December 10, 2012 by Janilabo Quote Link to comment Share on other sites More sharing options...
LordJashin Posted December 10, 2012 Share Posted December 10, 2012 Nice. Good effort. I can read this in math when im utterly bored today Quote Link to comment Share on other sites More sharing options...
Janilabo Posted December 10, 2012 Author Share Posted December 10, 2012 Nice. Good effort. I can read this in math when im utterly bored today Thanks mate Quote Link to comment Share on other sites More sharing options...
sleep Posted December 10, 2012 Share Posted December 10, 2012 Thanks for posting this up, I might be able to write something that will work now! Quote Link to comment Share on other sites More sharing options...
Janilabo Posted December 10, 2012 Author Share Posted December 10, 2012 (edited) Thanks for posting this up, I might be able to write something that will work now! Thanks sleep! Glad to hear it helps. I will be updating this intro more tomorrow. Also, I recommend you take a look at ACA v2 (AutoColorAid) by nielsie95, with it you can find best tolerances for colors in Project RSC (to deal with the color changes).. If you look for "ACA SRL" or "ACA YoHoJo" from YouTube, you can find great video tutorial about using ACA (uses for RS2, but the same things work ib RSC aswell!) Another method is using color arrays, with FindColors[Ex](). Use the method you find better to use. I found out that there's 5 different brightness modes in Project RSC. So you need to pick colors from all of those 5 modes, this is very easy to do with ACA. Also, you can do what I used to do: Keep screencapturing for 5 mins every 10-15 seconds and you can get colors of each brightness mode. With ACA you can easily check where certain colors are found. -Jani Edited December 10, 2012 by Janilabo Quote Link to comment Share on other sites More sharing options...
tweakmeup Posted December 11, 2012 Share Posted December 11, 2012 Thanks jani, ive always been confused about text and all. Still waiting on walking improvements before I actually start scripting again though. Question:when you do a boolean function that returns true, what can you do with the true value afterwards?? Do you just do if then outside the statement? - - - Updated - - - Thanks jani, ive always been confused about text and all. Still waiting on walking improvements before I actually start scripting again though. Question:when you do a boolean function that returns true, what can you do with the true value afterwards?? Do you just do if then outside the statement? Quote Link to comment Share on other sites More sharing options...
Janilabo Posted December 11, 2012 Author Share Posted December 11, 2012 Question:when you do a boolean function that returns true, what can you do with the true value afterwards?? Do you just do if then outside the statement?Ello mate (and thank you!), Good example would be PRSC_LoggedIn function, I use it at nearly every Project RSC procedure/function (to make sure we are even logged in). Take a look at this Fish procedure from Karamja PowerFisher: procedure Fish; var x, y: Integer; begin repeat if (PRSC_LoggedIn and not fatigueFull) then begin if PRSC_StaffMemberDetected then HandleStaffMemberDetection; if (((GetSystemTime - movementMark) > 290000) or MSSL_IsBitmapIn(youHaveNot, 4, 253, 92, 321)) then IdleMovement; case PRSC_UpTextContains(spotUpText) of True: if ((GetSystemTime - lastFishing) > (FISH_INTERVAL + Random(FISH_INTERVAL_RANDOMNESS))) then begin MSSL_Click(mbLeft); lastFishing := GetSystemTime; end; False: if FindFishingSpot(x, y) then MSSL_MoveAt(x, y); end; fatigueFull := MSSL_IsBitmapIn(youAreTooTired, 4, 291, 102, 319); end; PRSC_Wait(0); until (fatigueFull or not PRSC_LoggedIn); end; ..function boolean results used in that are: PRSC_LoggedIn PRSC_UpTextContains(spotUpText) FindFishingSpot(x, y) MSSL_IsBitmapIn(youHaveNot, 4, 253, 92, 321) MSSL_IsBitmapIn(youAreTooTired, 4, 291, 102, 319) So, the boolean results they are very important indeed. But yeah, PRSC_LoggedIn is the one I use most - just to make sure we are even logged in to do our actions. ..if we are not logged in, then we can exit the procedures for logging in OR warning us.. By the way, I still recommend you'll do some scripting, because then you can improve your skills. Also, when you do scripting, you get all kinds of great ideas while you work on the logic (even repeating the simple tasks you are automatically working on logic and ideas). SO - don't give up! ..also, I released this introduction because I really want these things to be more community-based (not only up to me, like right now), the more people - the more great ideas and creations! With good ideas we can get things going really nicely - and sometimes basic ideas/concepts could/might be enough for beating up some complex problems. It's just that we need to come up with those ideas. Freddy has added plenty of power to SCAR Divi 3.37+, so future looks bright! Next year there will be that new DTM System with brave new Editor aswell, so its definitely worth the wait. BUT, while we wait, we should try and make the other parts/things finished. Regards, -Jani Quote Link to comment Share on other sites More sharing options...
Janilabo Posted December 14, 2012 Author Share Posted December 14, 2012 I have been working a lot for MSSL lately (just released 0.99-37b that is based on SCAR Divi 3.38!), and that work has also required some seriously big changes in MSSL. http://svn.scar-divi.com/mssl/trunk/Development/Changelogs/0.99-37b.log So, I will be updating this introduction/documentation again within this weekend. Will be releasing also new version(s) of MSSL aswell, with even more stuff that I have already planned. Quote Link to comment Share on other sites More sharing options...
LordJashin Posted December 14, 2012 Share Posted December 14, 2012 I have been working a lot for MSSL lately (just released 0.99-37b that is based on SCAR Divi 3.38!), and that work has also required some seriously big changes in MSSL.http://svn.scar-divi.com/mssl/trunk/Development/Changelogs/0.99-37b.log So, I will be updating this introduction/documentation again within this weekend. Will be releasing also new version(s) of MSSL aswell, with even more stuff that I have already planned. As usual you amaze me. Idk how you manage to pump out so much . You must have a lot of free time? OSI's has sagged behind , MSSL Ftw at this point. I commend you....good job Jani! Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted December 15, 2012 Share Posted December 15, 2012 As usual you amaze me. Idk how you manage to pump out so much . You must have a lot of free time?Time machine, clones, or given up on sleeping: take your pick. Quote Link to comment Share on other sites More sharing options...
LordJashin Posted December 15, 2012 Share Posted December 15, 2012 Time machine, clones, or given up on sleeping: take your pick. Clones, or he just knows SCAR coding so much he can do it blind folded. Then just pop ideas in his brain every 2 minutes. Have you seen MSSL? He has all these functions and stuff. I don't know what the majority of it does either. So many types. His logging file blows my mind... need to look at his coding style more with the idx, and len variables (like freddy does) and all that in some of the functions. Quote Link to comment Share on other sites More sharing options...
TerryKig Posted July 24 Share Posted July 24 bafin crypto 1 bitcoin gold to eur aarnav crypto best cryptos casinos cryptocurrency ranking best laptop to trade crypto aion crypto partners amp crypto sec what is cryptocurrency and how does it work $ben coin buy phenibut with bitcoin are there crypto billionaires 1099 misc crypto.com how can i buy bitcoin in sri lanka how to buy bitcoin for silk road get free crypto airdrop o2t crypto launch date will shiba ever reach 1 cent current value of pi coin best low cap crypto coins goated gamer 015 bitcoin bloomberg bitcoin 500k crypto chain link ntx crypto price adresse portefeuille bitcoin can i buy 100 dollars of bitcoin downfall of the crypto king buying bitcoin on paypal review cardano outlook netflix for mac download eclipse crypto big five tech companies best crypto wallet for beginners 350 cad to bitcoin crypto token development crypto mommy porn best free crypto signals telegram avalanche prediction crypto don't buy bitcoin you idiots shan shan wong stability ai ahort bitcoin art blocks crypto 100 days venture crypto buy physical bitcoin define initial coin offering biden $100 billion dragonic fortune agc crypto coin alchemy pay crypto reddit Quote Link to comment Share on other sites More sharing options...