Author Topic: Constant arrays  (Read 759 times)

0 Members and 1 Guest are viewing this topic.

Offline meneldil

  • Major(1)
  • Posts: 3
  • RaveN
Constant arrays
« on: July 03, 2009, 06:20:17 pm »
Code: [Select]
const
playervarnames: array[1..2] of string = ('pass', 'stuff');

I checked on the internet, this is valid pascal. Yet, soldat server won't compile it.

From what I guess, soldat server takes the "script", compiles it and uses it as a dynamic library - so it must use a normal pascal compiler. If that's so, why the hell won't it work? :(

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: Constant arrays
« Reply #1 on: July 04, 2009, 03:59:42 am »
Valid pascal <> Soldat pascal :P

You can do this:
Code: [Select]
const
  v1 = 'yyy';
  v2 = 'zzz';

var xxx: array[1..2] of string;

procedure ActivateServer();
begin
  xxx[1]:= v1;
  xxx[2]:= v2;
end;
I know it sucks bottle but I don't know other way.
« Last Edit: July 04, 2009, 04:01:56 am by Gizd »

Offline LORD KILLA

  • Camper
  • ***
  • Posts: 254
  • Happie
Re: Constant arrays
« Reply #2 on: July 04, 2009, 12:32:44 pm »
but you cant initialize normal vars, do you ?
Code: [Select]
var MyVar: integer = 1234;

Offline meneldil

  • Major(1)
  • Posts: 3
  • RaveN
Re: Constant arrays
« Reply #3 on: July 04, 2009, 05:26:45 pm »
Valid pascal <> Soldat pascal :P

You can do this:
Code: [Select]
const
  v1 = 'yyy';
  v2 = 'zzz';

var xxx: array[1..2] of string;

procedure ActivateServer();
begin
  xxx[1]:= v1;
  xxx[2]:= v2;
end;
I know it sucks bottle but I don't know other way.

I thought of a similar thing, but if I use something like that, I'll feel defeated :P
I'm an optimization maniac, I need a const array, it needs the least resources :)


but you cant initialize normal vars, do you ?
Code: [Select]
var MyVar: integer = 1234;

Nope.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Constant arrays
« Reply #4 on: July 04, 2009, 06:54:35 pm »
Soldat pascal is very limited, not only when it comes to things that relate to Soldat or the dedicated server, but as well as operators such as "as" and features as you mentioned just now.

Offline danmer

  • Camper
  • ***
  • Posts: 466
  • crabhead
Re: Constant arrays
« Reply #5 on: July 05, 2009, 02:46:59 pm »
yeah, assigning "constant" values to var arrays in ActivateServer should be as close as you can get to what you need =/ You dont really want to mess with shitloads of separate constants...