WT-Fakawi
2008-01-14 17:49:36
To avoid the problem of clicking on-the-same-tile, I made this little script, that walks from Lumbridge to Falador. I recorded all the tiles from Lumbridge to Falador, and saved them in a one dimensional array. I pick out a random tile from the list to walk the path, and a hook that enables you to start anywhere along or in the neighborhood of the path. So you can stop the script anywhere and restart. It will still walk to Falador. This is still in alpha, but for me it is a simple and effective way to avoid robotic tile clicks. I am sure you guys can come up with smarter stuff, since it is such an ugly array :(
program LumToFally;
{.include SRL/SRL/Misc/Smart.scar}
{.include SRL/SRL.scar}
var
Path: Array of Integer;
Procedure DeclarePlayers;
begin
NumberOfPlayers(1);
CurrentPlayer := 0;
Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;
end;
procedure LoadPath;
begin
Path := [3222, 3219, 3223, 3219, 3224, 3219, 3225, 3219, 3226, 3219,
3227, 3219, 3228, 3219, 3229, 3219, 3230, 3219, 3231, 3219, 3232, 3219,
3232, 3220, 3232, 3221, 3232, 3222, 3232, 3223, 3232, 3224, 3232, 3225,
3232, 3226, 3231, 3226, 3230, 3226, 3229, 3227, 3229, 3228, 3230, 3229,
3230, 3230, 3230, 3231, 3230, 3232, 3230, 3233, 3229, 3233, 3229, 3234,
3228, 3234, 3228, 3235, 3227, 3235, 3227, 3236, 3226, 3236, 3226, 3237,
3225, 3237, 3225, 3238, 3224, 3238, 3223, 3239, 3222, 3240, 3222, 3241,
3221, 3241, 3222, 3241, 3221, 3242, 3221, 3243, 3221, 3244, 3221, 3245,
3221, 3246, 3221, 3247, 3221, 3248, 3220, 3248, 3219, 3249, 3219, 3250,
3219, 3251, 3219, 3252, 3218, 3252, 3218, 3253, 3217, 3253, 3217, 3254,
3216, 3254, 3217, 3255, 3217, 3256, 3217, 3257, 3217, 3258, 3217, 3259,
3217, 3260, 3217, 3261, 3217, 3262, 3217, 3263, 3217, 3264, 3217, 3265,
3217, 3266, 3217, 3267, 3217, 3268, 3216, 3268, 3216, 3269, 3216, 3270,
3216, 3271, 3216, 3272, 3216, 3273, 3216, 3274, 3216, 3275, 3216, 3276,
3215, 3276, 3215, 3277, 3214, 3277, 3213, 3277, 3212, 3277, 3211, 3277,
3210, 3277, 3210, 3278, 3209, 3278, 3208, 3278, 3207, 3278, 3206, 3278,
3205, 3278, 3204, 3278, 3203, 3278, 3202, 3278, 3201, 3278, 3200, 3278,
3199, 3278, 3198, 3278, 3198, 3279, 3197, 3279, 3197, 3280, 3196, 3280,
3195, 3280, 3194, 3280, 3193, 3280, 3192, 3280, 3191, 3280, 3190, 3280,
3190, 3281, 3189, 3281, 3189, 3282, 3188, 3282, 3187, 3282, 3186, 3282,
3185, 3282, 3184, 3282, 3183, 3282, 3182, 3283, 3181, 3284, 3180, 3285,
3179, 3286, 3178, 3286, 3177, 3286, 3176, 3286, 3175, 3286, 3174, 3286,
3173, 3286, 3172, 3286, 3171, 3286, 3170, 3286, 3169, 3286, 3168, 3286,
3167, 3286, 3166, 3286, 3165, 3286, 3164, 3286, 3163, 3286, 3162, 3286,
3161, 3287, 3161, 3288, 3160, 3288, 3160, 3289, 3159, 3289, 3158, 3290,
3159, 3290, 3158, 3291, 3157, 3292, 3156, 3292, 3155, 3292, 3154, 3292,
3153, 3293, 3153, 3294, 3152, 3294, 3151, 3294, 3150, 3294, 3150, 3295,
3149, 3295, 3148, 3295, 3147, 3295, 3146, 3295, 3145, 3295, 3144, 3295,
3143, 3295, 3142, 3295, 3141, 3295, 3140, 3295, 3139, 3295, 3138, 3295,
3137, 3296, 3136, 3296, 3135, 3296, 3134, 3296, 3133, 3296, 3132, 3296,
3131, 3296, 3130, 3296, 3129, 3296, 3128, 3296, 3127, 3296, 3126, 3296,
3125, 3296, 3124, 3296, 3123, 3296, 3122, 3295, 3121, 3295, 3120, 3295,
3119, 3295, 3118, 3295, 3117, 3295, 3116, 3295, 3115, 3295, 3114, 3295,
3113, 3295, 3112, 3295, 3111, 3295, 3110, 3295, 3109, 3295, 3108, 3295,
3107, 3295, 3106, 3295, 3105, 3295, 3104, 3295, 3103, 3295, 3102, 3295,
3101, 3295, 3100, 3295, 3099, 3295, 3098, 3295, 3097, 3295, 3096, 3294,
3095, 3293, 3094, 3292, 3093, 3291, 3092, 3291, 3091, 3291, 3090, 3291,
3089, 3291, 3088, 3291, 3087, 3290, 3086, 3290, 3085, 3290, 3084, 3290,
3083, 3290, 3082, 3289, 3081, 3288, 3080, 3287, 3079, 3286, 3079, 3285,
3079, 3284, 3078, 3283, 3077, 3284, 3076, 3284, 3075, 3283, 3074, 3282,
3073, 3281, 3072, 3280, 3071, 3279, 3070, 3278, 3069, 3278, 3068, 3278,
3067, 3278, 3066, 3278, 3065, 3278, 3064, 3278, 3063, 3278, 3062, 3278,
3061, 3278, 3060, 3278, 3059, 3277, 3058, 3276, 3057, 3275, 3056, 3275,
3055, 3275, 3054, 3275, 3053, 3275, 3052, 3275, 3051, 3275, 3050, 3275,
3049, 3275, 3048, 3275, 3047, 3275, 3046, 3275, 3045, 3275, 3044, 3275,
3043, 3275, 3042, 3275, 3041, 3275, 3040, 3275, 3039, 3275, 3039, 3276,
3038, 3276, 3037, 3276, 3036, 3276, 3035, 3276, 3034, 3276, 3034, 3277,
3033, 3277, 3032, 3277, 3031, 3277, 3030, 3277, 3029, 3277, 3028, 3277,
3027, 3277, 3026, 3277, 3025, 3277, 3024, 3277, 3023, 3277, 3022, 3277,
3021, 3277, 3021, 3278, 3020, 3278, 3020, 3279, 3019, 3279, 3018, 3279,
3017, 3279, 3016, 3279, 3015, 3279, 3014, 3279, 3013, 3279, 3012, 3279,
3011, 3279, 3011, 3280, 3011, 3281, 3010, 3281, 3010, 3282, 3009, 3282,
3009, 3283, 3008, 3283, 3008, 3284, 3007, 3284, 3008, 3285, 3008, 3286,
3007, 3287, 3007, 3288, 3007, 3289, 3007, 3290, 3007, 3291, 3007, 3292,
3007, 3293, 3007, 3294, 3007, 3295, 3007, 3296, 3007, 3297, 3007, 3298,
3007, 3299, 3007, 3300, 3007, 3301, 3007, 3302, 3007, 3303, 3007, 3304,
3007, 3305, 3007, 3306, 3007, 3307, 3007, 3308, 3007, 3309, 3007, 3310,
3007, 3311, 3007, 3312, 3007, 3313, 3007, 3314, 3007, 3315, 3007, 3316,
3007, 3317, 3007, 3318, 3007, 3319, 3007, 3320, 3007, 3321, 3007, 3322,
3007, 3323, 3007, 3324, 3007, 3325, 3007, 3326, 3007, 3327, 3007, 3328,
3007, 3329, 3007, 3330, 3007, 3331, 3007, 3332, 3007, 3333, 3007, 3334,
3007, 3335, 3007, 3336, 3007, 3337, 3007, 3338, 3007, 3339, 3007, 3340,
3007, 3341, 3007, 3342, 3007, 3343, 3007, 3344, 3007, 3345, 3007, 3346,
3007, 3347, 3007, 3348, 3007, 3349, 3007, 3350, 3007, 3351, 3007, 3352,
3007, 3353, 3007, 3354, 3007, 3355, 3007, 3356, 3007, 3357, 3007, 3358,
3008, 3359, 3009, 3359, 3010, 3359, 3011, 3359, 3012, 3359, 3012, 3358,
3012, 3357, 3012, 3356, 3012, 3355];
end;
// -- Simple Printout of all tiles you cross, in above format --//
procedure WalkRecorder;
var
O,N: Tpoint;
Road: array of TPoint;
T, C: Integer;
Sr, St: String;
begin
repeat
GetMyPos(O.x, O.y);
if ((O.x <> N.x) or (O.y <> N.y)) then
begin
GetMyPos(N.x, N.y);
writeln(IntToStr(N.x) + ', ' + IntToStr(N.Y));
C := C + 1;
SetArrayLength(Road, C * 2);
Road[c].x := N.x;
Road[c].y := N.y;
for T := 0 to c do
begin
St := IntToStr(Road[T].x) + ', ' + IntToStr(Road[T].y) + ', ';
Insert(St, Sr, Length(Sr));
end;
Writeln(Sr);
SetLength(Sr, 0);
end;
until false
end;
//-- Walks along the Path, choosing randomly from pathtile, and finding nearest
// -- tile thorugh simple match. No failsafes yet :)
procedure WalkPath;
var
x, y, s,z ,Tx, Ty, TryPoint, DefPoint:Integer;
begin
GetMyPos(Tx, Ty);
repeat
z := z + 2;
until Distance(Tx, Ty, Path[z],Path[z + 1]) <= 30;
DefPoint:= z;
repeat
repeat
TryPoint := DefPoint;
s:= Random(30) * 2;
TryPoint:= TryPoint + s;
TileToMinimap(Path[TryPoint],Path[TryPoint + 1], x, y);
until rs_OnMiniMap(x,y);
DefPoint := TryPoint;
Mouse(x, y, 2, 2, True);
FFlag(10);
until DefPoint > GetarrayLength(Path) - 1;
end;
// -------------------------------------------------------------------------- //
// -------------------------------------------------------------------------- //
// -------------------------------------------------------------------------- //
begin
SmartSetup('ams4', false, false);
SmartSetTarget;
SetupSRL;
DeclarePlayers;
LoginPlayer;
// WalkRecorder;
LoadPath;
WalkPath;
end.
The algorithm would take the boundary of the path expressed in straight segments and follow an arbitrary path through it that is within the bounds and generally follows the contour central path. Not unlike a really complex mouse movement algorithm, but on a grand scale :)