SRL Archive - Help and Support

Adding to an existing record?


Narcle

2008-05-21 08:46:59

Well I want to add a array to the existing Player record.

"Player.Combat"

Can you add to the existing TUser record?

I was guessing like this:
  type
TUser = record
Combat: array[0..3] of string;
end;

That way I can use:
Player.Combat[0]
Player.Combat[1]
Player.Combat[2]
Player.Combat[3]

Idk if thats correct thats why I'm asking.

Markus

2008-05-21 10:08:56

Sorry, but that's unfortunately not possible with scar.
You can use Players[].Strings[], but can't have inheritance.

Sumilion

2008-05-21 10:11:47

From Players.scar :

type
TUser = record
Name: string; // * User Name
Pass: string; // * User Pass
Pin: string; // * Current Users Pin Number
Nick: string; // * Screen Name for random detection
NickTPA: TPointArray; // * TPA Of Player Name
Level: array[0..24] of Word; // * Levels of all skills.
Active: Boolean; // * Set to True if Ok, False if Lost.
Loc: string; // * User Location
Skill: string; // * User Action to Perform
Worked: Integer; // * Time User has worked
Banked: Integer; // * Number of Banks User has done
Rand: string; // * Current Random
Booleans: array of Boolean; // * For reports, etc.
Integers: array of Integer; // * For reports, etc.
Strings: array of string; // * For reports, etc.
Extendeds: array of Extended; // * For reports, etc.
end;

You could just add your line there to make it :

type
TUser = record
Name: string; // * User Name
Pass: string; // * User Pass
Pin: string; // * Current Users Pin Number
Nick: string; // * Screen Name for random detection
NickTPA: TPointArray; // * TPA Of Player Name
Level: array[0..24] of Word; // * Levels of all skills.
Active: Boolean; // * Set to True if Ok, False if Lost.
Loc: string; // * User Location
Skill: string; // * User Action to Perform
Worked: Integer; // * Time User has worked
Banked: Integer; // * Number of Banks User has done
Rand: string; // * Current Random
Booleans: array of Boolean; // * For reports, etc.
Integers: array of Integer; // * For reports, etc.
Strings: array of string; // * For reports, etc.
Extendeds: array of Extended; // * For reports, etc.
Combat: array[0..3] of string;
end;

But that will only work for your SRL when you change that. Afaik it is not possible to add it without changing the record in Players.scar

Narcle

2008-05-21 11:47:46

Yeah I just did some experiments with it… U can't add to the record.
Thanks for confirmation guys.

Guess I'll just use Strings 90-93 or something.

the scar noob

2008-05-21 16:57:28

From: Markus
Sorry, but that's unfortunately not possible with scar.
You can use Players[].Strings[], but can't have inheritance.


But with Delphi you actually can, right? You can have inheritance, override, etc over there. Right? (I know it's kinda off topic:p)

-Tsn.

R0b0t1

2008-05-21 17:28:26

Not with SCAR.

Try


ChangeCombatVar(Player: Integer; Value: String);

and have it access them. Still provides… Uh… a front end.

Dan Cardin

2008-05-21 18:02:13

could you do something like

type
NewThing = record
Setup: TUser;
Combat: array of integer;
end;

would that be satisfactory?

Narcle

2008-05-22 05:22:28

From: Dan Cardin
could you do something like

type
NewThing = record
Setup: TUser;
Combat: array of integer;
end;

would that be satisfactory?


Yeah I was thinking of making a new record for it. But I have it setup to just use strings 50-53 atm.

This new system its turning out pretty nice. I'll post it when its finish. Its basically an very advance version of "SetFightMode."

the scar noob

2008-05-22 05:23:38

From: Dan Cardin
could you do something like

type
NewThing = record
Setup: TUser;
Combat: array of integer;
end;

would that be satisfactory?


That's not a bad idea at all. Nicely found, new type with player type in it:p

-Tsn.

nielsie95

2008-05-22 09:12:53

If you'd do that, you would still have to do:

NewThing.Setup.Name := ;
NewThing.Combat[1] := ;

How would you switch players then? :p
I think it's best to use Players[x].Strings or make a separate array/record named PlayerInfo or something:

Players[0].Name = 'Nielsie95';
PlayerInfo[0].CombatMode = 'attack';

Narcle

2008-05-22 09:45:23

From: nielsie95
If you'd do that, you would still have to do:

NewThing.Setup.Name := ;
NewThing.Combat[1] := ;

How would you switch players then? :p
I think it's best to use Players[x].Strings or make a separate array/record named PlayerInfo or something:

Players[0].Name = 'Nielsie95';
PlayerInfo[0].CombatMode = 'attack';


Aye thats why I'm using the existing strings… But now that I'm farther into developing it I think I might try using a array setup for more advance settings.

So I can record everything about the style. Stab, crush, slice, rapid, accurate… etc. Since there is certain styles that work better on some mobs then others.