SRL Archive - Outdated Tutorials

[#32] UseRewardBox - How To Use This new SRL Feature


ZephyrsFury

2009-04-16 15:06:54

With the release of the latest Public SRL Revision comes a new feature for scripters and script users. The UseRewardBox and supporting functions will open and select the desired reward items based the on preference of the script's users. This comes in the form of a new addition to the Players array:


Players[0].Name := 'SRL Developers';
Players[0].Pass := 'WelcomeToRev32';
Players[0].Nick := 'eve';
Players[0].Active := True;
Players[0].Integers[0] := 0;
Players[0].BoxRewards := ['mote', 'ostume', 'XP', 'Gem', 'ithril', 'oal'];

The 'BoxRewards' variable is a TStringArray ie. array of string. This array contains the text or partial text of the reward item in order of preference. That is in the above example the items will be searched for in the order: Emote, Costume, XP Lamp, Gem, Mithril ore, Coal. Note however, the text you enter must appear exactly as it is in the Reward Box window. This includes capitalization.

NOTE: If you do not wish to open the box you may leave the variable as an empty array with a length of 0. ie:

Players[0].BoxRewards := [];

If SRL comes across this it will not open the box.
For Script Users:

From Rev 32 onwards any script that has the above BoxRewards option will allow you to enter in your reward items in order of preference.

If the variable does not exist in the DeclarePlayers procedure then (unless there is a reason the scripter did not put it there) you can add the option yourself.

For Scripters:

All you need to do is go through your scripts and add Players[X].BoxRewards to your DeclarePlayers procedure. SRL will handle the rest.

Thanks to Nava2 for this wonderful new feature!

Enjoy,

SRL Development Team.

Sir R. M8gic1an

2009-04-16 15:31:05

3 things:
1. Move to Intermidiate
2. Sticky
3. Add to SRL Player Form?

edit: /me notices the thread is closed >.>

~RM

ShowerThoughts

2009-04-16 19:57:57

Sounds interesting! Good job!

Floor66

2009-04-16 20:52:33

Maybe put in an SRL default of just choosing the coins if you want to get rid of it? :p
Just an idea so not all scripts have to be edited if you aren't really interested in the rewards.
Maybe put it like; if it finds a lamp then pick that one and use the old 'LampSkill'; else the costume; else the coins.

HyperSecret

2009-04-16 21:22:15

From: Floor66
Maybe put in an SRL default of just choosing the coins if you want to get rid of it? :p
Just an idea so not all scripts have to be edited if you aren't really interested in the rewards.
Maybe put it like; if it finds a lamp then pick that one and use the old 'LampSkill'; else the costume; else the coins.


I agree there should be some default to if the option is not available that the user is seeking (such as coins) or have the script automatically drop the box.

ZephyrsFury

2009-04-16 21:23:58

From: HyperSecret
I agree there should be some default to if the option is not available that the user is seeking (such as coins) or have the script automatically drop the box.


By default it clicks the Mystery Box if none of the preferences are found. But FindNormalRandoms won't call UseRewardBox if the length of BoxRewards is 0.

Nava2

2009-04-16 23:30:56

It just stays in your inventory otherwise.

Thanks Zeph, I probably should have written this :)

mormonman

2009-04-17 01:31:40

Meh, how do we set the lamp reward? Do we do it the same way… I haven't had time to go through the new include yet, I am at school. I guess I am going to have a long afternoon of reading :p.

Nava2

2009-04-17 06:47:39

From: mormonman
Meh, how do we set the lamp reward? Do we do it the same way… I haven't had time to go through the new include yet, I am at school. I guess I am going to have a long afternoon of reading :p.


I'd do 'XP', and 'xp'

lordsaturn

2009-04-17 07:03:02

How about something like
type
_Rewards = (Emote, Costume, XP Lamp, Gem, Mithril ore, Coal); //more of course
BoxRewards = array of _Rewards;

procedure SetupBoxStrings;
begin
for i := 0 to HowManyPlayers - 1 do
begin
L := Length(Players[i].BoxRewards);
SetLength(Players[i].BoxSearch, L);
for j := 0 to L - 1 do
case Players[i].BoxRewards[j] of
0: Players[i].BoxSearch[j] := 'mote';
1: Players[i].BoxSearch[j] := 'ostume';
2: Players[i].BoxSearch[j] := 'XP';
//etc
end;
end;
end;
Much more user friendly.
Players[0].BoxRewards := [Emote, XP, Costume];

mormonman

2009-04-17 07:20:56

No, I mean how do we choose which skill to use xp for? Is it the same as old way?

ZephyrsFury

2009-04-17 08:41:19

From: mormonman
No, I mean how do we choose which skill to use xp for? Is it the same as old way?


FindLamp will still click on the lamp if it finds one in your inv.

WhoCares357

2009-04-17 15:01:25

Question.

Is this implemented into the SRL player array or do we have to add it ourselves?

ZephyrsFury

2009-04-17 15:04:02

From: WhoCares357
Question.

Is this implemented into the SRL player array or do we have to do add it ourselves?


Its already there. You just need to add it to DeclarePlayers.

WhoCares357

2009-04-17 20:36:31

From: ZephyrsFury
Its already there. You just need to add it to DeclarePlayers.


What about the SRL Player form?

ZephyrsFury

2009-04-18 11:17:15

From: WhoCares357
What about the SRL Player form?


We're working on that.

Sir R. M8gic1an

2009-04-18 19:28:52

From: ZephyrsFury
We're working on that.


I've got news on that. I've done it, i'll post it up once i get home ^.^

~RM

Punkgi

2009-04-18 23:31:08

I put the
Players[0].BoxRewards := ['ostume'];

where its supposed to be and it just leaves the box in my invitory

ZephyrsFury

2009-04-19 05:45:44

It only attempts to open the box after it solves a random. It doesn't check for the box all the time.

Punkgi

2009-04-19 11:31:09

From: ZephyrsFury
It only attempts to open the box after it solves a random. It doesn't check for the box all the time.


Yeah I figured that out after I got another random. Thanks.

Is there a way to tell it to just drop the box?