Author Topic: Helping with my first script  (Read 4016 times)

0 Members and 1 Guest are viewing this topic.

Offline Irlandec

  • Soldier
  • **
  • Posts: 176
Helping with my first script
« on: June 24, 2008, 03:35:36 am »
Hello! Now I'm working with my first script in pascal: ManiacMod. In some time , I learned some basics , and with support of this forum and its members, I succeded to make General part of the script. The problem is: Compiler shows me some errors.I tried to fix , but it won't dissapear. Please help me with my first script


If it is not hard, please fix the errors and post right code here  or just tell me how to fix and I will try doing it myself

The CODE (Un-fixed)

P.S: Every questions about the script will be answered by me when i can.

P.S.S.: Script Name changed to ManiacMod




« Last Edit: July 24, 2008, 02:47:01 pm by Irlandec »

Offline EnEsCe

  • Retired Soldat Developer
  • Flamebow Warrior
  • ******
  • Posts: 3101
  • http://enesce.com/
    • [eC] Official Website
Re: Helping with my first script
« Reply #1 on: June 24, 2008, 04:33:22 am »
/sigh.... Read the lines the compiler tells you.

Code: [Select]
const
//system
sVERSION = '0.0.1 beta'
//colours

Oh my! There's no semicolon. What a genius it takes to see that! And I'll let you figure out the blatantly obvious other place where you've forgotten a semicolon.

Offline Irlandec

  • Soldier
  • **
  • Posts: 176
Re: Helping with my first script
« Reply #2 on: June 24, 2008, 04:44:28 am »
Danm  :o ! I forgot! Thank you , mighty EnEsCe!

Date Posted: June 24, 2008, 05:38:16 am
[Error] (32:11): String error
[Error] (32:11): Syntax error

Danm , I'm so noob ;(

From the beginnig of the procedure (Line 29 is first)

Code: [Select]
procedure OnJoinGame(ID, Team: byte);
begin
  Command('/setteam1 + inttostr(ID));
//Player greeting
if Team = 1 then begin
DrawText(ID, 'Blah!',cGreet);
  end;
 end;
« Last Edit: June 24, 2008, 04:47:19 am by Irlandec »

Offline EnEsCe

  • Retired Soldat Developer
  • Flamebow Warrior
  • ******
  • Posts: 3101
  • http://enesce.com/
    • [eC] Official Website
Re: Helping with my first script
« Reply #3 on: June 24, 2008, 04:50:58 am »
You forgot to put a ' in between setteam and the +. These mistakes are pretty clear, please look over your code before referring to others.

Offline Irlandec

  • Soldier
  • **
  • Posts: 176
Re: Helping with my first script
« Reply #4 on: June 24, 2008, 05:43:28 am »
Thx for helping :)

Finally compiler showed me no errors , so I can continue on working with script.

How to code this thing: If NumOfAlpha equals to 0 then begin Command('/nextmap') and DrawText(ID, 'Blah',cSomeColour)
How it will be in Pascal?

Offline Toumaz

  • Veteran
  • *****
  • Posts: 1906
Re: Helping with my first script
« Reply #5 on: June 24, 2008, 05:58:34 am »
How to code this thing: If NumOfAlpha equals to 0 then begin Command('/nextmap') and DrawText(ID, 'Blah',cSomeColour)
How it will be in Pascal?

Code: [Select]
If AlphaPlayers = 0 then begin
    Command('/nextmap');
    DrawText(0, 'Blah', cSomeColour);
end;

Offline Irlandec

  • Soldier
  • **
  • Posts: 176
Re: Helping with my first script
« Reply #6 on: June 24, 2008, 06:01:30 am »
Thx, Toumaz! New problem:
(27:1): Identifier expected

Procedure beginning line 26
Code: [Select]
procedure OnPlayerSpeak(ID: byte; Text: string);
begin
  if (Text = '!knife') then begin
      ForceWeapon(ID,GetPlayerStat(ID,'Primary'),14,0);
      WriteConsole(ID, 'You recieved a bonus knife',cInfo);
  end;
end;

What kind of indetificator I missed?
« Last Edit: June 24, 2008, 06:07:47 am by Irlandec »

Offline shantec

  • Soldier
  • **
  • Posts: 140
  • Get ANGREH!!
Re: Helping with my first script
« Reply #7 on: June 24, 2008, 06:57:10 am »
Why wont you just tell us what to do and we'll script it for you? ;)
Joke...

Soo... actually, the procedure beginning line is 27 (because somewhy the first line in notepad is actually 2nd line)
meaning that your missing something from that line.
Your missing "boolean" before the last semicolon
Also Known As REIMA


Lol Happles (happy apples)

Offline Irlandec

  • Soldier
  • **
  • Posts: 176
Re: Helping with my first script
« Reply #8 on: June 24, 2008, 09:55:16 am »
Huh? Sorry, but you can call me blind, stupid baby. What semicolon exactly? I got my brains cooked :(

Here's a new source code with a little fixes... But still errors :(
If it isn't so hard for you , please take a peek and suggest me how to fix errors

Problems:
(27:1): Identifier expected

This code gone to sleep
« Last Edit: July 23, 2008, 07:20:42 am by Irlandec »

Offline Boblekonvolutt

  • Soldier
  • **
  • Posts: 222
  • "YOU are a CAR."
Re: Helping with my first script
« Reply #9 on: June 24, 2008, 10:25:14 am »
Haven't checked it all, but the problem on line 27 seems to be that you forgot an end;

Offline shantec

  • Soldier
  • **
  • Posts: 140
  • Get ANGREH!!
Re: Helping with my first script
« Reply #10 on: June 24, 2008, 10:51:11 am »
Well, i was bored so i fixed it all: Here
But if you want to fix it by yourself, dont go there :D
Also Known As REIMA


Lol Happles (happy apples)

Offline Irlandec

  • Soldier
  • **
  • Posts: 176
Re: Helping with my first script
« Reply #11 on: July 16, 2008, 11:13:55 am »
Thx , you helped me! + for credits! :)

Date Posted: June 24, 2008, 01:50:30 pm
Ok , my script is nearly to 'see-the-world' state , but I still have questions:

For exmaple, there is a command /test . When player type it , timer strats counting down. If timer is not equal to 0, THIS player cannot use comand /test until timer is 0. I made the timer and command , the only thing is how to block using command if timer is not equal to 0 (boolean , i think)

Offline As de Espada

  • Soldat Beta Team
  • Veteran
  • ******
  • Posts: 1493
  • Mapper
    • My maps
Re: Helping with my first script
« Reply #12 on: July 16, 2008, 03:52:08 pm »
probably you're using a variable for the count down
I always let the counting in -1, then
if counting>0 then blablabala

Date Posted: July 16, 2008, 06:51:36 pm
I don't know exacly what you want with this test, but that should work
All my maps | my latest map: SoldatX Racing Mappack
me making a map on youtube: ctf_FastMade

Offline iDante

  • Veteran
  • *****
  • Posts: 1967
Re: Helping with my first script
« Reply #13 on: July 16, 2008, 04:17:12 pm »
at the top:
Code: [Select]
boolean bla = false;
in onspeakwhatever:
Code: [Select]
if Text = '/test' then bla := true;
in apponidle
Code: [Select]
int i := 50;
if bla = true then begin
   if i = 0 then begin
      bla := false;
      i := 50;
   end;
   else
      {More STuff HERE}
      i--;
end;

is that kindof what you were looking for?
BTW that will most definitely not compile... I don't know pascal so well, so that should just be like... psuedocode

Offline chutem

  • Veteran
  • *****
  • Posts: 1119
Re: Helping with my first script
« Reply #14 on: July 17, 2008, 01:51:38 am »
Dude, I strongly suggest you change the whole 'story' of this script.
I reckon it will offend some people, it is pretty blatant.

Quote
Use your knife to kill gays and spas to push them
Quote
Use your chainsaw to rape hunters
Quote
You got raped and became a gay
Quote
Gays have taken over the world

It would probably get boring reading those messages over and over again, especially having use of only 3 weapons...

So, change the story, and do something to make it more interesting, i.e, a new gun which you can use to run away with.

This is so that your release is better.
« Last Edit: July 17, 2008, 01:54:58 am by chutem »
1NK3FbdNtH6jNH4dc1fzuvd4ruVdMQABvs

Offline Irlandec

  • Soldier
  • **
  • Posts: 176
Re: Helping with my first script
« Reply #15 on: July 20, 2008, 03:09:49 am »
Err , As De Espada's post seems more likely to me. For changing the 'story' - well , i will, just need the script finished. I'm posting what I really want do do with timer

Code: [Select]
procedure AppOnIdle(Ticks: integer);
begin
if timer > 0 then begin
timer := timer - 1;
if timer = 0 then
WriteLn('Skill cooled down');
end;
end;

procedure OnPlayerSpeak(ID: Byte; Text: string);
begin
 if (text = '!knife') then begin
  ForceWeapon(ID,GetPlayerStat(ID,'Primary'),14,0);
  WriteConsole(ID, 'Knife used. 30 seconds cooldown',cInfo);
  timer := 60;
 end;
end;

If timer is <> 0 , then (!knife command is not useable until timer = 0)


Date Posted: July 18, 2008, 05:15:11 am
Script Name changed to ManiacMod due to restrict offence for other people.

Offline As de Espada

  • Soldat Beta Team
  • Veteran
  • ******
  • Posts: 1493
  • Mapper
    • My maps
Re: Helping with my first script
« Reply #16 on: July 20, 2008, 11:46:54 am »
ok, now you just have to make the player wait
and it's 30 seconds or 60?
Code: [Select]
procedure OnPlayerSpeak(ID: Byte; Text: string);
begin
if (text = '!knife') then begin
  if timer=0 then begin
    ForceWeapon(ID,GetPlayerStat(ID,'Primary'),14,0);
    WriteConsole(ID, 'Knife used. 30 seconds cooldown',cInfo);
    timer := 30;
  else
    WriteConsole(ID, inttostr(timer) + 'seconds coolldown',cInfo);   
end;
end;
All my maps | my latest map: SoldatX Racing Mappack
me making a map on youtube: ctf_FastMade

Offline Irlandec

  • Soldier
  • **
  • Posts: 176
Re: Helping with my first script
« Reply #17 on: July 20, 2008, 12:10:04 pm »
30 seconds. So timer counts in seconds, not ticks? By the way , thx ;)

Errored , missed identifier

Code: [Select]
procedure OnPlayerSpeak(ID: Byte; Text: string);
begin
 if (text = '!credits') then begin
//Some stuff goes here
 end;

 if (text = '!kit') then begin
  if timer = 0 then begin
    ForceWeapon(ID,5,14,0);
    WriteConsole(ID, 'Hunter Kit used. 30 seconds cooldown',cInfo);
    timer := 30;
  else
    WriteConsole(ID, inttostr(timer) + 'seconds coolldown',cInfo);
  end;
 end;
end;

timer identifier is in another procedure
« Last Edit: July 20, 2008, 12:22:42 pm by Irlandec »

Offline shantec

  • Soldier
  • **
  • Posts: 140
  • Get ANGREH!!
Re: Helping with my first script
« Reply #18 on: July 20, 2008, 04:05:38 pm »
Hmm, if i understrood right, every time you type !knife , you get knife and YOU have 30 secs cooldown?

Well, ur script is only using ONE countdown per SERVER!! So, every time someone types !knife, everyone haves to wait that 30 secs, and only one can use it at time ::)


Sooo, things to change:
'Var timer: integer;' should be changed 'Var timer: array[1..32] of integer;'
Also those Timer things must be Timer(ID), Timer(Victim) ect ect, depending on function / procedure
Also Known As REIMA


Lol Happles (happy apples)

Offline M.rSnow

  • Camper
  • ***
  • Posts: 482
Re: Helping with my first script
« Reply #19 on: July 23, 2008, 04:41:57 am »
I think the homosexual population of soldat might be offended. Dont you dare say "You feel offended?" because Im not homusexual.
Lapis: You need a vacation or a bullet though the head both works just fine by me.