SRL Archive - Reflection (Archive)

Reflection randoms


Naike

2010-10-15 11:02:45

Since so many people are developing on the randoms I figured it'll be the best to update the core. Hardly any(if any?) random solvers work in reflection, so it's a perfect timing!

I started thinking, and figured the best way to do this is clearly the same way SRL does it.

This might break a script or two, not sure if it does(can't really see how it would).

Changes that's made
  • Now it's not including all of the "Randomname.simba" files, as none worked. (They'll stay there as an example for the re-built/modifications to work again).
  • Took Anti-Randoms consts from Constants.simba to Antirandoms.simba (duh, should've been there in the first place).
  • New r_SetupRandoms added.
  • Added r_GetMusic (needed for R_SolveNonTalkingRandoms).
  • Added a new R_SolveNonTalkingRandoms.

r_SetupRandoms

Const
r_RandomCount = 18;

R_RANDOM_ABYSS = 0;
R_RANDOM_BEEKEEPER = 1;
R_RANDOM_CAPNARRAV = 2;
R_RANDOM_CERTER = 3;
R_RANDOM_DRILLDEMON = 4;
R_RANDOM_EVILBOB = 5;
R_RANDOM_EXAM = 6;
R_RANDOM_FREAKYFORESTER = 7;
R_RANDOM_FROG = 8;
R_RANDOM_GRAVEDIGGER = 9;
R_RANDOM_MAZE = 10;
R_RANDOM_MIME = 11;
R_RANDOM_MOLLY = 12;
R_RANDOM_PILLORY = 13;
R_RANDOM_PINBALL = 14;
R_RANDOM_PRISON = 15;
R_RANDOM_QUIZ = 16;
R_RANDOM_SANDWICHLADY = 17;

type
r_Random = Record
RandName, Music: String;
r_InRandom, r_SolveRandom: function: Boolean;
end;

var
r_RandomArr: Array [0..14] of r_Random;
r_RandomVarSet: Boolean;

Procedure r_SetupRandoms;
begin
With r_RandomArr[R_RANDOM_ABYSS] do
begin
RandName := 'Abyss';
Music := 'into the abyss';
r_InRandom := nil;
r_SolveRandom := nil;
end;

With r_RandomArr[R_RANDOM_BEEKEEPER] do
begin
RandName := 'Beekeeper';
Music := 'horizon';
r_InRandom := nil;
r_SolveRandom := nil;
end;

With r_RandomArr[R_RANDOM_CAPNARRAV] do
begin
RandName := 'Cap n'' Arrav';
Music := 'sea shanty';
r_InRandom := nil;
r_SolveRandom := nil;
end;

With r_RandomArr[R_RANDOM_CERTER] do
begin
RandName := 'Certer';
Music := '';
r_InRandom := nil;
r_SolveRandom := nil;
end;

With r_RandomArr[R_RANDOM_DRILLDEMON] do
begin
RandName := 'Drill Demon';
Music := 'corporal punishment';
r_InRandom := nil;
r_SolveRandom := nil;
end;

With r_RandomArr[R_RANDOM_EVILBOB] do
begin
RandName := 'Evilbob';
Music := 'evil bob''s island';
r_InRandom := nil;
r_SolveRandom := nil;
end;

With r_RandomArr[R_RANDOM_EXAM] do
begin
RandName := 'Exam';
Music := 'school''s out';
r_InRandom := nil;
r_SolveRandom := nil;
end;

With r_RandomArr[R_RANDOM_FREAKYFORESTER] do
begin
RandName := 'Freaky forester';
Music := 'pheasant peasant';
r_InRandom := nil;
r_SolveRandom := nil;
end;

With r_RandomArr[R_RANDOM_FROG] do
begin
RandName := 'Frog';
Music := 'frogland';
r_InRandom := nil;
r_SolveRandom := nil;
end;

With r_RandomArr[R_RANDOM_GRAVEDIGGER] do
begin
RandName := 'Gravedigger';
Music := 'spooky';
r_InRandom := nil;
r_SolveRandom := nil;
end;

With r_RandomArr[R_RANDOM_MAZE] do
begin
RandName := 'Maze';
Music := 'time out';
r_InRandom := nil;
r_SolveRandom := nil;
end;

With r_RandomArr[R_RANDOM_MIME] do
begin
RandName := 'Mime';
Music := 'artistry';
r_InRandom := nil;
r_SolveRandom := nil;
end;

With r_RandomArr[R_RANDOM_MOLLY] do
begin
RandName := 'Molly';
Music := 'head to head';
r_InRandom := nil;
r_SolveRandom := nil;
end;

With r_RandomArr[R_RANDOM_PILLORY] do
begin
RandName := 'Pillory';
Music := '';
r_InRandom := nil;
r_SolveRandom := nil;
end;

With r_RandomArr[R_RANDOM_PINBALL] do
begin
RandName := 'Pinball';
Music := '';
r_InRandom := nil;
r_SolveRandom := nil;
end;

With r_RandomArr[R_RANDOM_PRISON] do
begin
RandName := 'Prison';
Music := 'in the clink';
r_InRandom := nil;
r_SolveRandom := nil;
end;

With r_RandomArr[R_RANDOM_QUIZ] do
begin
RandName := 'Quiz';
Music := '';
r_InRandom := nil;
r_SolveRandom := nil;
end;

With r_RandomArr[R_RANDOM_SANDWICHLADY] do
begin
RandName := 'Sandwhich lady';
Music := 'snack attack';
r_InRandom := nil;
r_SolveRandom := nil;
end;

r_RandomVarSet := True;
end;


New r_SolveNonTalkingRandoms

function R_SolveNonTalkingRandoms: Boolean;
var
I, iTime: Integer;
Music: String;
InRand: Boolean;
begin
If Not LoggedIn then
Exit;

If Not r_RandomVarSet then
r_SetupRandoms;

Music := LowerCase(r_GetMusic);
for I := 0 to r_RandomCount-1 do
begin

If (r_RandomArr[I].Music = Music)or(r_RandomArr[I].Music = '')then
if (r_RandomArr[I].r_InRandom <> nil) then
InRand := r_RandomArr[I].r_InRandom()
else
begin
If (Not(r_RandomArr[I].r_InRandom <> nil)and(r_RandomArr[I].Music = ''))then
Continue;
Writeln('[Reflection] Might be in a random(missing r_InRandom function), terminating.');
Players[CurrentPlayer].Rand := r_RandomArr[I].RandName;
Logout;
Exit;
end;

If InRand then
begin
Players[CurrentPlayer].Rand := r_RandomArr[I].RandName;
Writeln('[Reflection] Trying to solve: ' + r_RandomArr[I].RandName);
if (r_RandomArr[I].r_SolveRandom <> nil) then
Result := r_RandomArr[I].r_SolveRandom()
else
begin
Writeln('[Reflection] No random solver for this random yet!, terminating');
Logout;
Exit;
end;

If not Result then
begin
Writeln('[Reflection] Random solving for ' + r_RandomArr[I].RandName + ' failed, terminating.');
Logout;
Exit;
end else
Writeln('[Reflection] Random solved');

iTime := GetSystemTime;
While (Not IsIdle) do
begin
Wait(100+Random(100));
if (GetSystemTime-iTime > 60*1000)then
begin
Writeln('[Reflection] Took more than a minute to get out of the random, terminating.');
LogOut;
Exit;
end;
end;

UseRewardBox;
Exit;
end;

end;
end;


So.. how does it work?
  1. Check music. If music = "" @ Skips the search for music.
  2. Runs the specific r_InRandom function
  3. If it's in the random it'll output a text saying that's desovered and that the solving is starting.
  4. r_SolveRandom is executed

Discuss?

For the maintaining part, I'll help out.
I will end up doing a random or two(possibly)!


Note: This is not commit yet. It won't be until tomorrow, or later today.
Reason for that is fairly simple, I want to be able to write a tutorial on how the separate random functions should work and be structured.

Cstrike

2010-10-15 11:19:41

Another way to check for some randoms might be the inventory pouch disappearing (but I don't know how to detect that yet besides color).

I'm in the pinball, so I'll get that music to update here. I'm also going to try that one


BTW we may need all the hooks updated for certain randoms (like wall interactable's like the abyss random)

Naike

2010-10-15 11:29:29

From: cstrike
Another way to check for some randoms might be the inventory pouch disappearing (but I don't know how to detect that yet besides color).

I'm in the pinball, so I'll get that music to update here. I'm also going to try that one


BTW we may need all the hooks updated for certain randoms (like wall interactable's like the abyss random)


This system is bullet proof if the r_InRandom is correctly done.
Hooks will be added along the way, don't worry 'bout that ;)

mormonman

2010-10-15 12:01:45

r_InRandom's should be done with object and npc detection.

Naike

2010-10-15 12:17:29

From: mormonman
r_InRandom's should be done with object and npc detection.


Object or/and NPC detection..

mormonman

2010-10-15 13:00:44

From: Naike
Object or/and NPC detection..


Ya, thats what I meant.

Naike

2010-10-15 13:03:19

From: mormonman
Ya, thats what I meant.


Are you going to help out? :wub:

mormonman

2010-10-15 13:07:42

From: Naike
Are you going to help out? :wub:


I'm thinking about it…I just set up simba on my netbook..

Naike

2010-10-15 13:25:21

Well, it'll be a great timing!

Hope to see you doing a random!
It's rather fun when you think about it :)

Overtime

2010-10-15 15:23:29

If you guys need randoms, I get them 24/7 since i run MSI 24/7.
Just let me know which ones your on the look out for, and add me on MSN.

Cstrike

2010-10-15 15:51:08

From: Squancy
If you guys need randoms, I get them 24/7 since i run MSI 24/7.
Just let me know which ones your on the look out for, and add me on MSN.


If you get any, can you post in this thread :) ?
ANY randoms are good.\

if you don't hear a response in 24 hours then just do the random and continue on autoing so we don't waste your time if no one is available

JPHamlett

2010-10-15 16:23:48

I'll see what I can do as far as randoms go.

I know alot of you guys already have a great number of them solved and working, but I'll see what I can do here and there. I'd help out alot more but my RL is interfering alot. lol

Naike

2010-10-15 16:45:30

From: J_Pizzle
I'll see what I can do as far as randoms go.

I know alot of you guys already have a great number of them solved and working, but I'll see what I can do here and there. I'd help out alot more but my RL is interfering alot. lol


..We're doing them all from scratch/old files. Making sure that they work.
Great number = 0.

Help out if you can, not forced to do so :redface:

Overtime

2010-10-15 18:44:26

I have:

1 in Maze.
1 in Pinball.
1 in Mr. Mordaut
1 in Certer (Niles)

I think Miles works fine but im not sure.

I hope you guys can take a look at them asap, as I am an MSI Junkie. :P

Cstrike

2010-10-15 19:27:56

From: Squancy
I have:

1 in Maze.
1 in Pinball.
1 in Mr. Mordaut
1 in Certer (Niles)

I think Miles works fine but im not sure.

I hope you guys can take a look at them asap, as I am an MSI Junkie. :P


I'm working on the pinball one once a minor problem is resolved, doubt I'll have it done in 24 h though

If you wanted to send the certer my way i could try and work on that :)

Naike

2010-10-16 04:42:23

Here's the deal..

I'm going to be busy a bit more than I thought, so the how-to writing for randoms might be delayed. When the how-to is written, it'll all take a rocket start from there!

Bad Boy JH

2010-10-17 02:02:19

I have one in leo (gravedigger), haven't got around to doing the random solver for that yet…

Cstrike

2010-10-17 10:22:55

From: Bad Boy JH
I have one in leo (gravedigger), haven't got around to doing the random solver for that yet…


There's some code ZephyrsFury made which you will need if you attempt that if I recall correctly.