Author Topic: Variant Help  (Read 1978 times)

0 Members and 1 Guest are viewing this topic.

Offline Bellamy

  • Major(1)
  • Posts: 42
Variant Help
« on: June 30, 2008, 03:00:40 pm »
I'm writing a script for my server and I'm having trouble figuring out what I should put in the variant section. I put in the OnFlagGrab event and one of the variants you use for it is "TeamFlag: byte". But I need "Red" or "Blue" and not "Team". So, in the variant section I typed "RedFlag: byte" and "BlueFlag: byte" and I started the server and there was "an expected identifier on line 3 character 4. And that is where I put "RedFlag: byte".

Here is my script. It is probably completely wrong, as this is my very first script to write.
Please give me your knowledge.  :)

Code: [Select]
// Bellamy's Assassin Mod
var;
AlphaFlag: byte;
BravoFlag: byte;
True: boolean;
False: boolean;

procedure OnFlagGrab(ID, TeamFlag: byte;GrabbedInBase: boolean)
begin
if RedFlag then WriteConsole(0,'Kill the blue assassin!!',$FF0000);
if BlueFlag then WriteConsole(0,'Kill the red assassin!!',$FF0000);
end;
end;
end;

function GetPlayerStat(ID: byte; Stat: string): Variant
begin
WriteLn('Player1s flagger is '+inttostr(GetPlayerStat(1,'flagger)));
if True then ForceWeapon(1, 8, 12, 100)
if False then DoDamage(1,50);
end;
end;
end;
end;
begin
WriteLn('Player2s flagger is '+inttostr(GetPlayerStat(2,'flagger)));
if True then ForceWeapon(1, 8, 12, 100)
if False then DoDamage(1,50);
end;
end;
end;
end;
begin
WriteLn('Player3s flagger is '+inttostr(GetPlayerStat(3,'flagger)));
if True then ForceWeapon(1, 8, 12, 100)
if False then DoDamage(1,50);
end;
end;
end;
end;
begin
WriteLn('Player4s flagger is '+inttostr(GetPlayerStat(4,'flagger)));
if True then ForceWeapon(1, 8, 12, 100)
if False then DoDamage(1,50);
end;
end;
end;
end;
begin
WriteLn('Player5s flagger is '+inttostr(GetPlayerStat(5,'flagger)));
if True then ForceWeapon(1, 8, 12, 100)
if False then DoDamage(1,50);
end;
end;
end;
end;
begin
WriteLn('Player6s flagger is '+inttostr(GetPlayerStat(6,'flagger)));
if True then ForceWeapon(1, 8, 12, 100)
if False then DoDamage(1,50);
end;
end;
end;
end;
begin
WriteLn('Player7s flagger is '+inttostr(GetPlayerStat(7,'flagger)));
if True then ForceWeapon(1, 8, 12, 100)
if False then DoDamage(1,50);
end;
end;
end;
end;
begin
WriteLn('Player8s flagger is '+inttostr(GetPlayerStat(8,'flagger)));
if True then ForceWeapon(1, 8, 12, 100)
if False then DoDamage(1,50);
end;
end;
end;
end;
begin
WriteLn('Player9s flagger is '+inttostr(GetPlayerStat(9,'flagger)));
if True then ForceWeapon(1, 8, 12, 100)
if False then DoDamage(1,50);
end;
end;
end;
end;
begin
WriteLn('Player10s flagger is '+inttostr(GetPlayerStat(10,'flagger)));
if True then ForceWeapon(1, 8, 12, 100)
if False then DoDamage(1,50);
end;
end;
end;
end;
begin
WriteLn('Player11s flagger is '+inttostr(GetPlayerStat(11,'flagger)));
if True then ForceWeapon(1, 8, 12, 100)
if False then DoDamage(1,50);
end;
end;
end;
end;
begin
WriteLn('Player12s flagger is '+inttostr(GetPlayerStat(12,'flagger)));
if True then ForceWeapon(1, 8, 12, 100)
if False then DoDamage(1,50);
end;
end;
end;
end;
begin
WriteLn('Player13s flagger is '+inttostr(GetPlayerStat(13,'flagger)));
if True then ForceWeapon(1, 8, 12, 100)
if False then DoDamage(1,50);
end;
end;
end;
end;
begin
WriteLn('Player14s flagger is '+inttostr(GetPlayerStat(14,'flagger)));
if True then ForceWeapon(1, 8, 12, 100)
if False then DoDamage(1,50);
end;
end;
end;
end;
begin
WriteLn('Player15s flagger is '+inttostr(GetPlayerStat(15,'flagger)));
if True then ForceWeapon(1, 8, 12, 100)
if False then DoDamage(1,50);
end;
end;
end;
end;
begin
WriteLn('Player16s flagger is '+inttostr(GetPlayerStat(16,'flagger)));
if True then ForceWeapon(1, 8, 12, 100)
if False then DoDamage(1,50);
end;
end;
end;
end;

Offline iDante

  • Veteran
  • *****
  • Posts: 1967
Re: Variant Help
« Reply #1 on: June 30, 2008, 03:12:35 pm »
Code: [Select]
// Bellamy's Assassin Mod
var;
True: boolean;
False: boolean;
I dont think you can do that...
Quote from: Bellamy link=topic=28108.msg334455#msg334455  date=1214856040
Code: [Select]
procedure OnFlagGrab(ID, TeamFlag: byte;GrabbedInBase: boolean)[b];[/b] // you forgot the semicolon too.
begin
if RedFlag then WriteConsole(0,'Kill the blue assassin!!',$FF0000);
if BlueFlag then WriteConsole(0,'Kill the red assassin!!',$FF0000);
end;
end;
end;
I dont see blueflag or redflag defined anywhere...

I also don't think that pascal can do object oriented stuff.

if(True) is like... always true. an infinite loop would be while(true)

get rid of all your
Code: [Select]
end;
begin
's
Ah I give up, this has waay too many errors to go through. Start with small bits of code, compile often to find errors.


Code: [Select]
function GetPlayerStat(ID: byte; Stat: string): Variant
begin
   WriteLn('Player1s flagger is '+inttostr(GetPlayerStat(1,'flagger)));
      if True then ForceWeapon(1, 8, 12, 100)
         if False then DoDamage(1,50);
         end;
      end;
   end;
end;
The indentation here is totally wrong. Here is a fixed version though it will not work because you can't modify GetPlayerStat. I'm also horribly confused as to what you are trying to do here, but whatever.
Code: [Select]
procedure whatever();
var i: Integer;
begin
   for i := 1 to 16 do begin
      writeLn('Player '+intToStr(i)+'s flagger is '+intToStr(GetPlayerStat(1,'flagger')));
      if GetPlayerStat(1,'flagger') then ForceWeapon(i, 8, 12, 100);
      if not GetPlayerStat(1,'flagger') then then DoDamage(i,50);
   end;
end;
« Last Edit: June 30, 2008, 03:24:12 pm by iDante »

Offline Neosano

  • Camper
  • ***
  • Posts: 253
  • IIAWAK!
Re: Variant Help
« Reply #2 on: June 30, 2008, 04:00:15 pm »
Man, did you heard about TEAMS?
0 no team(deathmatch)
1 Alpha
2 Bravo
3 Charlie
4 Delta

And.. its not a script ^_^
KAWAAAAAAAIIIIIIIIII

Offline Bellamy

  • Major(1)
  • Posts: 42
Re: Variant Help
« Reply #3 on: June 30, 2008, 05:10:06 pm »
iDante, I told you that it would probably be completely wrong. So please don't get mad. It's my first script. And yes, I should probably start with something less complicated. lol

I'm basically trying to, with this script, when the flag is captured, make it find which flag it was and what player and announce "Kill the assassin!!" , then give the EFC a sniper and knife.

It's really not that hard to figure out what I'm trying to do here if you looked at the script.
« Last Edit: June 30, 2008, 05:14:00 pm by Bellamy »

Offline JFK

  • Camper
  • ***
  • Posts: 255
    • My TraxInSpace Account
Re: Variant Help
« Reply #4 on: June 30, 2008, 05:15:55 pm »
Don't talk about variants, btw.. that's a variable type. You mean variables in general.
Start with something simple, bell ;)
Like.. admin invincibility or so..
Come join: EliteCTF
Listen to: My Music

Offline Bellamy

  • Major(1)
  • Posts: 42
Re: Variant Help
« Reply #5 on: June 30, 2008, 09:21:27 pm »
Code: [Select]
ForceWeapon(ID, 'flagger'), 8, 12, 100);

Ok, so I screwed that script and started this one.
This is only part of the script, but I need help fixing it.
It says "invalid number of paramaters" even though this is everything you need in it.

Please help.

Offline iDante

  • Veteran
  • *****
  • Posts: 1967
Re: Variant Help
« Reply #6 on: June 30, 2008, 10:54:21 pm »
Code: [Select]
ForceWeapon(ID, 'flagger'), 8, 12, 100);
At least THINK about it please.
Code: [Select]
procedure ForceWeapon(ID, Primary, Secondary, Ammo: Byte);
is the syntax. WTF is 'flagger'??

Offline Bellamy

  • Major(1)
  • Posts: 42
Re: Variant Help
« Reply #7 on: June 30, 2008, 11:13:26 pm »
'Flagger' is the stat from the "GetPlayerStat" function. Used to find out if the player has the flag or not.

Offline iDante

  • Veteran
  • *****
  • Posts: 1967
Re: Variant Help
« Reply #8 on: June 30, 2008, 11:15:57 pm »
Ok so since when was 'flagger' a primary weapon. In fact GetPlayerStat(ID,'flagger'); returns true or false, those aren't weapons either.

Offline Iq Unlimited

  • Flagrunner
  • ****
  • Posts: 864
  • mr. foobar2000
Re: Variant Help
« Reply #9 on: June 30, 2008, 11:25:43 pm »
*steps in*

ForceWeapon(ID, 8, 12, 100);

because it's in the OnFlagGrab procedure you can just call for the ID of the guy who grabbed the flag. Simple fix, no need to have GetPlayerStat(ID, 'flagger') in there.

Offline EnEsCe

  • Retired Soldat Developer
  • Flamebow Warrior
  • ******
  • Posts: 3101
  • http://enesce.com/
    • [eC] Official Website
Re: Variant Help
« Reply #10 on: June 30, 2008, 11:32:02 pm »
Bellamy, that has to be the worst brutalization of script syntax I have ever seen.

Offline Iq Unlimited

  • Flagrunner
  • ****
  • Posts: 864
  • mr. foobar2000
Re: Variant Help
« Reply #11 on: June 30, 2008, 11:42:51 pm »
I've seen worse, people ask me for help sometimes and it's not pretty...

Offline Bellamy

  • Major(1)
  • Posts: 42
Re: Variant Help
« Reply #12 on: June 30, 2008, 11:46:47 pm »
Yeah, Enesce, I already said that it was my first script. So please, don't think I'm like one of the most epic phailers in the world. I try.  :P

Offline danmer

  • Camper
  • ***
  • Posts: 466
  • crabhead
Re: Variant Help
« Reply #13 on: July 01, 2008, 12:15:23 pm »
reading a general pascal manual might help ::)

Offline xmRipper

  • Soldat Beta Team
  • Flagrunner
  • ******
  • Posts: 742
    • Personal
Re: Variant Help
« Reply #14 on: July 01, 2008, 12:27:38 pm »
FAIL
Co-Founder / CTO @ Macellan
Founder Turkish Soldat Community

Offline Iq Unlimited

  • Flagrunner
  • ****
  • Posts: 864
  • mr. foobar2000
Re: Variant Help
« Reply #15 on: July 01, 2008, 12:29:39 pm »
You have to love those one-word posts that sum up the thread.  [retard]

Offline amb2010

  • Camper
  • ***
  • Posts: 264
  • Fear the dot ...
Re: Variant Help
« Reply #16 on: July 01, 2008, 01:59:59 pm »
Gotta love those posts after the one word post that are useless  ;)

But as danmer said, you really should try to learn a little pascal(maybe the syntax) it will help you a lot also take a look at some scripts around here they can help you to figure out how to use a certain function.
And as the lyrics go in the United State's national anthem: "America, f**k YEAH!".