SRL Archive - OSR Help

Need Construction suggestions


Flight

2011-08-01 07:54:55

So… I'm making a Construction script to constantly make and destroy Oak Larders, it's working extremely well (average 140k/hour) and it handles all the building/destroying of larders as well as handling all the servants for gathering planks and servant payments.

I've one problem I could use some suggestions for. Upon re-entering your house (after a logout or random event, ect…) your servant will be no where near you, and for the script to work they must be close by beside you. So, how would I go about getting the servant to the kitchen effectively? A couple things to consider: Bell Ropes can call a servant, but no everyone would have this | You could left-click 'talk' to the servant (assuming they're even on your MM) and have them follow you to the larder, but what if they get stuck while following you?

Ideas are welcome!

Jakkle

2011-08-01 08:06:10

The bell would be best, dont take long to get the bell. you could do something like.
R_WalkToTile(ncp.tile, 0, 0);
TalkToNCP;
WalkToLarder;
If R_TileOnMs(NPC.tile, 0) Then
Exit;
Edited:Then repeat if you don't find the ncp :p.

Flight

2011-08-01 08:09:40

From: Jakkle
The bell would be best, dont take long to get the bell. you could do something like.
R_WalkToTile(ncp.tile, 0, 0);
TalkToNCP;
WalkToLarder;
If R_TileOnMs(NPC.tile, 0) Then
Exit;
Then repeat.


From: Flight

A couple things to consider: Bell Ropes can call a servant, but no everyone would have this | You could left-click 'talk' to the servant (assuming they're even on your MM) and have them follow you to the larder, but what if they get stuck while following you?


Getting to them, no problem, talking with them, no problem, getting to the larder without them getting stuck, problem.

I wonder if it would be require to first: talk with the servant, then turn running off, and just walk to the larder. I can still see them getting stuck, but less possibility.

Jakkle

2011-08-01 08:14:18

From: Flight
I wonder if it would be require to first: talk with the servant, then turn running off, and just walk to the larder. I can still see them getting stuck, but less possibility.


Thats a decent idea. I just wondering how are you getting the player to know where the larder is ? If peoples houses are different you can't use a certain tile.

As far as I remember you only need to locate the servant ask him to go bank to get whatever you want then run to the larder and wait for him to come back ?

Flight

2011-08-01 08:19:42

Yeah, if I can just get him to the larder once then we're set until we leave the house or log out.

The larder's location is an easy one, just search the MM for the larder OBJ and grab the tile from that, walk accordingly. And because we'll be in 'Build' mode, there's no doors.

Jakkle

2011-08-01 08:37:23

Was thinking that but wasn't sure. What I'm saying about getting him to the larder is, as soon as you go into the house/login find the servant first, ask him to go bank, he will then appear next to you and hand you the goods. so while he is gone head to the larder and he will appear there (No need to get him to follow you) ;)

Echo_

2011-08-01 09:35:14

From: Jakkle
Was thinking that but wasn't sure. What I'm saying about getting him to the larder is, as soon as you go into the house/login find the servant first, ask him to go bank, he will then appear next to you and hand you the goods. so while he is gone head to the larder and he will appear there (No need to get him to follow you) ;)


Yep, that's probably the best option. You just have to be quick enough to the kitchen before he gets back from the bank.

Brandon

2011-08-01 10:11:08

Good way or no?: If the butler is adjacent to u and the distance from him is less than Iunno 4?, then it will walk.. that way he doesn't get stuck behind objects.. U probably can edit the adjacent function to only check if he's adjacent from a distance.. because if your very far away from him and still adjacent, the adjacent function will return true no matter the distance.. but I guess thats why we have R_DistanceFromTile…

Edit: Thought of a good failsafe… Since the butler won't be tooo far from u, u can always check for objects between u and the butler and if ur adjacent, then the butler 100% cannot reach u.


{.include SRL\SRL\misc\SMART.SCAR}
{.include SRL\SRL.scar}
{.include reflection2\reflection.simba}
{.include SRL\SRL\Misc\PaintSmart.SCAR}

Function AdjacentTile(Tile: TTile): Boolean;
var
MyPos, NewTile: TTile;

begin
MyPos:= R_GetMyPos;
NewTile := Point((MyPos.x - Distance(Tile.X, 0, MyPos.X, 0)), MyPos.y);
if(NewTile = Tile) then
begin
Result:= true;
end;

NewTile := Point((MyPos.x + Distance(Tile.X, 0, MyPos.X, 0)), MyPos.y);
if(NewTile = Tile) then
begin
Result:= true;
end;

NewTile := Point(MyPos.X, (MyPos.y - Distance(0, Tile.Y, 0, MyPos.Y)));
if(NewTile = Tile) then
begin
Result:= true;
end;

NewTile := Point(MyPos.X, (MyPos.Y + Distance(0, Tile.Y, 0, MyPos.Y)));
if(NewTile = Tile) then
begin
Result:= true;
end;
end;

Function AdjacentDirection(Tile: TTile): string;
var
MyPos, NewTile: TTile;

begin
MyPos:= R_GetMyPos;
NewTile := Point((MyPos.x - Distance(Tile.X, 0, MyPos.X, 0)), MyPos.y);
if(NewTile = Tile) then
begin
Result:= 'w';
end;

NewTile := Point((MyPos.x + Distance(Tile.X, 0, MyPos.X, 0)), MyPos.y);
if(NewTile = Tile) then
begin
Result:= 'e';
end;

NewTile := Point(MyPos.X, (MyPos.y - Distance(0, Tile.Y, 0, MyPos.Y)));
if(NewTile = Tile) then
begin
Result:= 's';
end;

NewTile := Point(MyPos.X, (MyPos.Y + Distance(0, Tile.Y, 0, MyPos.Y)));
if(NewTile = Tile) then
begin
Result:= 'n';
end;
end;

Procedure FindButler;
var
Butler: TNPC;
begin
Repeat
if(R_FindNPC(ID, false, Butler)) then
begin
SmartClickMouse(R_TileToMS(Butler.Tile, 0).x, R_TileToMS(Butler.Tile, 0).y, false);
R_WaitOption('Talk', 500);
R_ChooseOption('Talk');
//Make him follow you here.. Or greet guests at the portal then follow u from there..
end;

while(AdjacentTile(Butler.Tile) and R_DistanceFromTile(Butler.Tile)) do
begin
R_SetRun(false);
R_WalkToTile(Larder.Tile, 1, 1);
end;
Until((R_GetMyPos = Larder.Tile) and (R_DistanceFromTile(Butler.Tile) < 3));
end;

Nava2

2011-08-01 12:30:22

Why not just send the butler to the bank then go to the larder? :)

Flight

2011-08-01 12:45:41

From: Nava2
Why not just send the butler to the bank then go to the larder? :)


That's what' I'm planning on doing. I just hope that 1… the butler is somewhere on the minimap, and 2… 5 seconds is long enough to run from the butler to the kitchen.

Boreas

2011-08-01 12:56:57

I placed a dining room next to each skill training room (kitchen, teletabs, etc), just so that I could call him. Kinda dirty, but gets the job done.

Flight

2011-08-01 13:15:09

Same here, I think that's the smart play, but since it's a public script it needs to be universal, and I'm sure not everyone have a dinning room next to their kitchen.

Jakkle

2011-08-01 14:39:45

From: Flight
Same here, I think that's the smart play, but since it's a public script it needs to be universal, and I'm sure not everyone have a dinning room next to their kitchen.


Most people do in real life, don't they ? But I see what your saying some weird people wouldn't. I have always put my kitchen next to the dinning room purely because its set in my head to be like that.
Anyway can reflection not tell where something is off screen ? I have been finding the closest bone off screen by finding the bone.tile within a radius of 30 and R_WalkToTile to it (didn't see if it was on the mini map tho) I just thought if it found the bone tile then it would click the closest point on the mini map to the bone.tile point, or am I wrong ?

Flight

2011-08-02 01:17:13

Just found out that if the servant is not on the MM, you cannot properly walk to him, you'll always walk south-west. So, any other ideas?

It's looking more and more like having a dinning room with a rope-ball in it, is the only option for running the script.

Brandon

2011-08-02 09:42:46

Me:= R_GetMyPos, MidTile:= R_GetMidTile(Me, Npc.Tile).

Then do if(R_TileOnMM(MidTile) then R_WalkToTile(MidTile);