Author Topic: Why this no work ? xD  (Read 1753 times)

0 Members and 1 Guest are viewing this topic.

Offline Drax

  • Soldier
  • **
  • Posts: 241
Why this no work ? xD
« on: March 03, 2014, 02:22:47 pm »
Don't laugh ! please? xD I am a starting noob at scripting and tbh I am not sure what I am doing ;p
this script does not work, baka admin says: -> [Error] (6:1): Identifier expected
what is this: Indentifier ???
Const
Text='/pre';

begin
if Text = '/pre' then begin
procedure GiveBonus(ID: 1; Bonus: 1);
end;
Result := false;
end;

~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Case#1 solved
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Case#2 in progress...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~


« Last Edit: March 12, 2014, 01:00:29 pm by Drax »

Offline skrX

  • Soldier
  • **
  • Posts: 112
  • x ye.
Re: Why this no work ? xD
« Reply #1 on: March 03, 2014, 02:42:24 pm »
EDIT:

Code: [Select]
const
COLOR = $FFFFFF;

function OnCommand(ID: Byte; Text: string): boolean;
begin
if (LowerCase(Text) = '/pre') then begin
GiveBonus(ID,1);
WriteConsole(ID,'You got predator',COLOR);
end;
Result := false;
end;

All is not as it should, read on devs soldat
« Last Edit: March 03, 2014, 02:50:40 pm by skrX »

Offline Drax

  • Soldier
  • **
  • Posts: 241
Re: Why this no work ? xD
« Reply #2 on: March 03, 2014, 02:54:44 pm »
can you explain this all, so I can learn something? please?

Offline skrX

  • Soldier
  • **
  • Posts: 112
  • x ye.
Re: Why this no work ? xD
« Reply #3 on: March 03, 2014, 03:07:55 pm »
But how do I explain it to you? everything you need is on devs soldat, learn to read with understanding.
Browse scripts and try to write something yourself, in this way for sure something you learn.
« Last Edit: March 03, 2014, 03:10:05 pm by skrX »

Offline Drax

  • Soldier
  • **
  • Posts: 241
Re: Why this no work ? xD
« Reply #4 on: March 03, 2014, 03:19:28 pm »
function OnCommand(ID: Byte; Text: string): boolean;
begin
   if (LowerCase(Text) = '/pre') then begin
      GiveBonus(ID,1);
   end;
   Result := false;
end;

this is simplified command, this is what you should have write for me instead of confusing(cuz I am noob) adds, but thanks I a lot.

but tell me what is this LowerCase for?? because if I delete this from the above cod I will get error "THEN" expected...

function OnCommand(ID: Byte; Text: string): boolean;
begin
if Text = '/tele >' then begin
MovePlayer(ID,GetPlayerStat(ID,'x')+200,GetPlayerStat(ID,'y')-1);
end;

it works without that "LowerCase"

« Last Edit: March 03, 2014, 03:29:03 pm by Drax »

Offline skrX

  • Soldier
  • **
  • Posts: 112
  • x ye.
Re: Why this no work ? xD
« Reply #5 on: March 03, 2014, 03:31:25 pm »
function OnCommand(ID: Byte; Text: string): boolean;
begin
   if (LowerCase(Text) = '/pre') then begin
      GiveBonus(ID,1);
   end;
   Result := false;
end;

this is simplified command, this is what you should have write for me instead of confusing(cuz I am noob) adds, but thanks I a lot.

but tell me what is this LowerCase for?? because if I delete this from the above cod I will get error "THEN" expected...

LowerCase supports text no matter how it is written, with small or large letters.
« Last Edit: March 04, 2014, 07:59:32 am by skrX »

Offline Drax

  • Soldier
  • **
  • Posts: 241
Re: Why this no work ? xD
« Reply #6 on: March 03, 2014, 03:36:33 pm »
why it's not working without "LowerCase" if everything is written with small letters? I mean the text: "/pre"


sorry for the first post:
Quote
why it's not working with "LowerCase" if everything is written with small letters?
« Last Edit: March 03, 2014, 03:47:01 pm by Drax »

Offline kicikici

  • Soldier
  • **
  • Posts: 180
Re: Why this no work ? xD
« Reply #7 on: March 03, 2014, 04:04:49 pm »
Replace
Code: [Select]
if (LowerCase(Text) = '/pre') then beginby
Code: [Select]
if Text = '/pre' then beginand try again.
Classic banana

Offline Drax

  • Soldier
  • **
  • Posts: 241
Re: Why this no work ? xD
« Reply #8 on: March 03, 2014, 05:25:45 pm »
Can I practice  here, and count on you guys? How about his:

procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);
begin
OnPlayerKill(1,2,1);
end;

-> [Error] (13:20): Type mismatch



what I did wrong....
« Last Edit: March 04, 2014, 01:48:18 am by Drax »

Offline Furai

  • Administrator
  • Veteran
  • *****
  • Posts: 1908
    • TransHuman Design
Re: Why this no work ? xD
« Reply #9 on: March 03, 2014, 06:07:47 pm »
Drax, please start listening to what other say. You cannot just keep asking about everything. You should start with some basic pascal programming course. When you'll finish it you'll understand the code more. Now you're just typing random stuff in and expect it to work when it will not. After you'll start to understand what pascal is you can get to soldat scripting. I'm really proud and at the same time astonished at the reaction of the soldat community. On any other forum you'd be ignored long time ago.

Guys here can probably link you to good tutorials as I haven't done any soldat scripting in a while. Soldat wiki isn't bad itself but only when you know something about programming already.
« Last Edit: March 03, 2014, 06:09:18 pm by Furai »
"My senses are so powerful that I can hear the blood pumping through your veins."

Offline Drax

  • Soldier
  • **
  • Posts: 241
Re: Why this no work ? xD
« Reply #10 on: March 04, 2014, 12:45:53 am »
To be honest with you I posted the same problem on other forum and people were also very kind :D and also I admit and agree with you I will try to educate myself more before another simple question... but the thing is, learning on your own takes more time and its harder, and I want to educate as fast as possible :D
« Last Edit: March 04, 2014, 12:47:56 am by Drax »

DarkCrusade

  • Guest
Re: Why this no work ? xD
« Reply #11 on: March 04, 2014, 10:00:55 am »
Book some course on programming basics, with whatever language.