Hello,
Im not a good scripter, but i want to improve myself.
I want to add Overload support to a fighting script.
Maybe someone could give me his way to add Overload.
Sorry for my bad English (German)
Regards
Hello,
Im not a good scripter, but i want to improve myself.
I want to add Overload support to a fighting script.
Maybe someone could give me his way to add Overload.
Sorry for my bad English (German)
Regards
Are you scripting in PascalScript or La-pe?
PascalScript doesn't support overloads, but la-pe does
Oh yes i mean Overload in Rs.
Hmm okay. This is not my Script. Its called Based Bandits.
Hmm are there any tutourials that could be useful for me ?
Don't feel bad, I was thinking the same thing.
Ok let's see, adding potion-handling to a script will be done in this process (roughly):
1) Time to take a sip?
2) Find the potion in the inventory
3) Clicking the potion
4) Resetting a "potion timer"
I'll let you handle Step 1 & 4, but I'll show you how to do Step 2 & 3.
For finding an item in the inventory, your best bet is to use DTMs; these are commonly used as their accuracy and simplicity make them very practical. To learn how to make DTMs you can check out one of these tutorials:
Creating Accurate DTMs
Yohojo's DTM Tut 1(Item finding with DTMs)
Now that you've made your DTM of your potion we'll want to find it & click it. I constructed a small example script of how to do this. It's self-explanatory:
Simba Code:{$I SRL/SRL.Simba}
Var
Potion: Integer;
Procedure LoadOurVars;
begin
Potion := DTMFromString('YOUR DTM STRING GOES HEREEEEEEE'); //First, let's define our "Potion" DTM
end;
Procedure FreeOurDTMs;
begin
FreeDTM(Potion);
end;
Function ClickPotion: Boolean;
var
x,y,PotionSlot: Integer;
begin
Result := False; //By default, this function should result False
if FindDTM(Potion,x,y,MIX1,MIY1,MIX2,MIY2) then //If our "Potion" DTM is found in the inventory then...
begin
PotionSlot := CoordsToItem(X,Y); //Convert the X/Y coordinate (that we found the Potion DMT at) into an inventory slot
MouseItem(PotionSlot, mouse_left); //Click the 'PotionSlot' inventory slot with a left-click action
Result := True; //We found & clicked the potion, so let's make this function result True (success!)
end;
end;
begin
SetupSRL;
LoadOurVars; //We MUST load our Potion DTM or the script won't know what to look for!
if ClickPotion then
Writeln('Took a sip of our potion!')
else
Writeln('No potion found...');
FreeOurDTMs; //ALWAYS free the DTMs after we're done using them (usually this is called when a script is stopped
end.
I hope that helps.
Edit:
Also as a small reference, MIX1 = Inventory X1, MIY1 = Inventory Y1, MIX2 = Inventory X2, MIY2 = Inventory Y2. Just in case you were wondering.
Last edited by Flight; 10-30-2012 at 02:12 AM.
Current projects:
[ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]
"I won't fall in your gravity. Open your eyes,
you're the Earth and I'm the sky..."
That's overflow, not overload
And yeah, I thought the same as Zyt3x too![]()
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 |
@Flight ,
Thanks for your help.
I will have a try adding Overloads.
Best Regards
Edit: I had a look on yohojos Dtm Tutourial, and i have a Question.
When i want to add a potion like Overload flask to my script, there are six different items ( Overload flask (6),
Overload flask (5), Overload flask (4), Overload flask (3), Overload flask (2) and Overload flask (1)).
Do i have to make Dtms of all of them ? Or only of the Overload flask(1)
Thanks
Last edited by jpwesemann; 11-02-2012 at 08:15 AM.
Okay,
I now made a Dtm of an Overload flask (1) and if i try it on other overload Flasks like (2,3,4) it will always find it. So i guess it is right
Im now trying to add these to the script![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)