I made this code a while ago to check if you have gained any levels in combat and how many.
And the main code:Code://By krazy_meerkat {^^^^^^^^^^^^^^^ CHECKCHATAREAMSG ^^^^^^^^^^^^^} {Checks the last sentence in the chat box and returns true if any part of that matches the string it's looking for} {^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^} Function CheckChatAreaMsg(Text: String) : Boolean; Begin result:= IsTextInAreaEx(20 , 415, 479, 433, x, y, Text, 40, CharChatChars, False, True, 0, 1, 0); End;
Use it in a report like this:Code:procedure LevelCheck; //by Krazy_Meerkat, how many levels you have gained. begin If(CheckChatAreaMsg('hitpoints')=true)Then begin hitpoints:=hitpoints+1 e:=(random(4)) if(e=1)then SendKeysHuman2('Alright, another hitpoint level!' + chr(13)); if(e=2)then begin if(hitpoints=1)then nummy:=('') if(not(hitpoints=1))then nummy:=('s') SendKeysHuman2('Sweet I got ' + (Inttostr(hitpoints)) + ' hitpoint level' + nummy + chr(13)); end; if(e=3)then SendKeysHuman2('I just hp leveled' + chr(13)); if(e=4)then SendKeysHuman2('Nice' + chr(13)); wait(random(5000) + random(845)); end else; If(CheckChatMsg('Congratulations')=true)Then begin other:=other+1 e:=(random(4)) if(e=1)then SendKeysHuman2('Alright, another ' + speech + ' level!' + chr(13)); if(e=2)then begin if(other=1)then nummy:=('') if(not(other=1))then nummy:=('s') SendKeysHuman2('Yeah got ' + (Inttostr(other)) + ' ' + speech + ' level' + nummy + chr(13)); end; if(e=3)then SendKeysHuman2('About time -.-' + chr(13)); if(e=4)then SendKeysHuman2('Yeah!!' + chr(13)); wait(random(5000) + random(845)); end; end;
The variables used:Code:if(Combat=1)then speech:=('attack') if(Combat=2)then speech:=('strength') if(Combat>2)then speech:=('defence') AddToReport ('Gained ' + Inttostr(other) + ' ' + speech + ' levels') AddToReport ('and ' + Inttostr(hitpoints) + ' hitpoints levels.')
speech,nummy,e: String;
speech is just the attack style, used for the report. Optional
nummy is a variable used for randomchat about gaining a level, depending on whether you've gained more than one level or not, it becomes an 's'. Optional
e is just a variable used for random numbers in randomchat. Optional
hitpoints,other,CharChatChars,Combat: Integer;
hitpoints, used to count how many hitpoints levels you have gained. Neccessary.
other, it will count how many attack,str,def levels you have gained (it does not need any input for your attack style). Neccessary.
CharChatChars is used for randomchat, add a line at the beginning of the main part of your script which says this:
Optional.Code:CharChatChars:= LoadChars2(AppPath + 'CharsChat2\');
Combat is just a number which represents your attack style (top to bottom). It is used for the report but can easily be replaced with your own variable. Replacable
Squig was used, so it should be completely compatable with SRL.






Reply With Quote


