SRL Archive - RS3 Help

SPS Fun Times


PheteyGee

2014-10-21 02:27:20

Hey Homies,

Looking for a bit of help regarding SPS.
I'm mucking around with a few different scripting ideas and I'm thinking about developing (it's been done before but I like to do things myself instead of copy to learn) an SPS Positioning Detection system. The way i'd like to do it is having numerous points for example:

At the location of a green tree
At the location of a red tree
At the location of a blue tree
At the location of a purple tree

Using SPS have coordinates for each of those locations. My thoughts are putting these points within a TBox to then allow SPS to check whether I am within the Tbox and the SPS location… so if I'm standing within the TBox created at the SPS Position of green tree, then when I call SPS.GetPlayerPos and i'm within that Tbox it verifies that I'm at the green tree and I can begin cooking rice…

I've come up against all sorts of problems and questions like… How do I get the SPS coordinates for the location of the green tree and how do I have them stored in a TBox? Do I use the SPS_Path_Generator Tool to make 2 points (xs, ys and xe, ye) and add them to Tbox = [xs, yx and xe, ye);?

Help please. Hope i've clarified well enough…

The Mayor

2014-10-21 02:35:02

Yes, use the SPS path tool to get the 2 points to make the box, and then input those coordinates into this function:


function isInArea(): boolean;
begin
result := pointInBox(sps.getPlayerPos(), intToBox(100, 200, 200, 300));
end;

PheteyGee

2014-10-21 02:42:30

hmm I'm planning on integrating this into an advance barbarian agility course. And was thinking of making them CONST values (within an array) or even a record… that way I can have all 8 obstacles there to call on and then return the value of the function to be array. i being the result of where the player is in response to the array. Make sense? Will that still work?

And with that code… the intToBox(100, 200, 200, 300); is intToBox(xs, ys, xe, ye);? (xs - ye being the SPS coordinates?)

The Mayor

2014-10-21 02:52:56

From: PheteyGee
hmm I'm planning on integrating this into an advance barbarian agility course. And was thinking of making them CONST values (within an array) or even a record… that way I can have all 8 obstacles there to call on and then return the value of the function to be array. i being the result of where the player is in response to the array. Make sense? Will that still work?

And with that code… the intToBox(100, 200, 200, 300); is intToBox(xs, ys, xe, ye);? (xs - ye being the SPS coordinates?)


Yes, x1, y1, x2, y2 of the box. See this post (grab the coords from sps map).

In terms of making each box a const and putting into an array, you can go:


const
OBSTACLE_0: TBox = [10, 10, 20, 20];
OBSTACLE_1: TBox = [10, 10, 20, 20];
OBSTACLE_2: TBox = [10, 10, 20, 20];
OBSTACLE_3: TBox = [10, 10, 20, 20];

OBSTACLE_ARRAY = [OBSTACLE_0, OBSTACLE_1, OBSTACLE_2, OBSTACLE_3];

function whereAmI(): integer;
var
i: integer
begin
for i := 0 to high(OBSTACLE_ARRAY) do
if pointInBox(sps.getPlayerPos(), OBSTACLE_ARRAY[i]) then
exit(i);
end;

Then you can do things like:

if whereAmI() = 2 then writeLn('We are at obstacle 2');

PheteyGee

2014-10-21 02:55:12

Yes! That's what I have done :) thanks for the clarification… just needed the pointInBox call :) thanks Mayor.

PheteyGee

2014-10-21 03:11:25

Hmm so general question… How do I piece together multiple SPS maps (for different levels?)… or should I just make a call to cycle through the 3 levels of maps to find the minimapbackground color (level 2 is black and level 3 has brown floors)… if I make that the check would I use 2 separate SPS maps or can i piece them together?

The Mayor

2014-10-21 04:48:55

From: PheteyGee
Hmm so general question… How do I piece together multiple SPS maps (for different levels?)… or should I just make a call to cycle through the 3 levels of maps to find the minimapbackground color (level 2 is black and level 3 has brown floors)… if I make that the check would I use 2 separate SPS maps or can i piece them together?


You can probably just put all 3 images on one map. You'll just have to see how it works.

Ashaman88

2014-10-21 11:10:59

I use the same methods for my advanced gnome agility script. I just made two maps though (one for all upstairs, one for all downstairs)

PheteyGee

2014-10-21 20:32:00

I use the same methods for my advanced gnome agility script. I just made two maps though (one for all upstairs, one for all downstairs)

I'll check out your Advance Gnome script Ashaman to have a look see at the SPS pics; I have a good idea of the logic just gotta put it down on paper.

You can probably just put all 3 images on one map. You'll just have to see how it works.

If I feel like looking into it, i'll look into this (it seems a little more advanced - and just adds to the flashiness of the script? not so much efficiency)..


Thanks Guys. Been a big help :)