Pascal

Moderators: None (Apply to moderate this forum)
Number of threads: 4095
Number of posts: 14004

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Please help a newbie :) Posted by Ezdo on 9 Aug 2006 at 8:48 PM
Could someone please explain to me how I would use the following default code? I dont really understand it and I dont need to modify it enough to warrant me learning the depths of pascal :P

Thx <3






unit UserDefined;{Dont change this!}

interface
uses SysUtils, AS_Functions{Dont delete this!};

//Use the following 2 procedures to react on ET-Events
procedure On_HotKey(AHotKey : Cardinal);
procedure On_LogLine(ALogLine : String);

//Use the procedure ExecETCommand(Command : String) to send a command to ET
implementation

procedure On_HotKey(AHotKey : Cardinal);
begin
writeln('HotKey:'+IntToStr(AHotKey));
end;

procedure On_LogLine(ALogLine : String);
begin
writeln('LogLine:'+AlogLine);
end;

end.
Report
Re: Please help a newbie :) Posted by zibadian on 10 Aug 2006 at 9:29 AM
: Could someone please explain to me how I would use the following default code? I dont really understand it and I dont need to modify it enough to warrant me learning the depths of pascal :P
:
: Thx <3
:
:
:
:
:
:
: unit UserDefined;{Dont change this!}
:
: interface
: uses SysUtils, AS_Functions{Dont delete this!};
:
: //Use the following 2 procedures to react on ET-Events
: procedure On_HotKey(AHotKey : Cardinal);
: procedure On_LogLine(ALogLine : String);
:
: //Use the procedure ExecETCommand(Command : String) to send a command to ET
: implementation
:
: procedure On_HotKey(AHotKey : Cardinal);
: begin
: writeln('HotKey:'+IntToStr(AHotKey));
: end;
:
: procedure On_LogLine(ALogLine : String);
: begin
: writeln('LogLine:'+AlogLine);
: end;
:
: end.
:
You can call both procedures like any other procedure:
program Example;

uses
  UserDefines;

begin
  On_LogLine('Hello World');
end.

Report
Re: Please help a newbie :) Posted by Ezdo on 10 Aug 2006 at 9:52 AM
: : Could someone please explain to me how I would use the following default code? I dont really understand it and I dont need to modify it enough to warrant me learning the depths of pascal :P
: :
: : Thx <3
: :
: :
: :
: :
: :
: :
: : unit UserDefined;{Dont change this!}
: :
: : interface
: : uses SysUtils, AS_Functions{Dont delete this!};
: :
: : //Use the following 2 procedures to react on ET-Events
: : procedure On_HotKey(AHotKey : Cardinal);
: : procedure On_LogLine(ALogLine : String);
: :
: : //Use the procedure ExecETCommand(Command : String) to send a command to ET
: : implementation
: :
: : procedure On_HotKey(AHotKey : Cardinal);
: : begin
: : writeln('HotKey:'+IntToStr(AHotKey));
: : end;
: :
: : procedure On_LogLine(ALogLine : String);
: : begin
: : writeln('LogLine:'+AlogLine);
: : end;
: :
: : end.
: :
: You can call both procedures like any other procedure:
:
: program Example;
: 
: uses
:   UserDefines;
: 
: begin
:   On_LogLine('Hello World');
: end.
: 

:


I probably should have given some kind of context for this -
Its the "advanced scripting" part of a program that reads lines from the console of a quake3 engine based game, such as "xx killed xx with a knife" or "You picked up a health pack" etc.
What I'm looking for is the correct syntax to do stuff like "When the console says xxxx, do xxxx"

Thats what those two default procedures are for, the On_LogLine one reads from the console, and the ExecETCommand one writes commands to the console.

I just dont know how to use them :P

Thanks anyway though.


Any further help would be greatly appreciated <3
Report
Re: Please help a newbie :) Posted by zibadian on 10 Aug 2006 at 10:23 AM
: : : Could someone please explain to me how I would use the following default code? I dont really understand it and I dont need to modify it enough to warrant me learning the depths of pascal :P
: : :
: : : Thx <3
: : :
: : :
: : :
: : :
: : :
: : :
: : : unit UserDefined;{Dont change this!}
: : :
: : : interface
: : : uses SysUtils, AS_Functions{Dont delete this!};
: : :
: : : //Use the following 2 procedures to react on ET-Events
: : : procedure On_HotKey(AHotKey : Cardinal);
: : : procedure On_LogLine(ALogLine : String);
: : :
: : : //Use the procedure ExecETCommand(Command : String) to send a command to ET
: : : implementation
: : :
: : : procedure On_HotKey(AHotKey : Cardinal);
: : : begin
: : : writeln('HotKey:'+IntToStr(AHotKey));
: : : end;
: : :
: : : procedure On_LogLine(ALogLine : String);
: : : begin
: : : writeln('LogLine:'+AlogLine);
: : : end;
: : :
: : : end.
: : :
: : You can call both procedures like any other procedure:
: :
: : program Example;
: : 
: : uses
: :   UserDefines;
: : 
: : begin
: :   On_LogLine('Hello World');
: : end.
: : 

: :
:
:
: I probably should have given some kind of context for this -
: Its the "advanced scripting" part of a program that reads lines from the console of a quake3 engine based game, such as "xx killed xx with a knife" or "You picked up a health pack" etc.
: What I'm looking for is the correct syntax to do stuff like "When the console says xxxx, do xxxx"
:
: Thats what those two default procedures are for, the On_LogLine one reads from the console, and the ExecETCommand one writes commands to the console.
:
: I just dont know how to use them :P
:
: Thanks anyway though.
:
:
: Any further help would be greatly appreciated <3
:
My guess is that you change the implementation (ie. between begin and end;) part of those functions to what you want it to say. That's the only thing I can think of based on this code.
Report
Re: Please help a newbie :) Posted by Phat Nat on 10 Aug 2006 at 7:28 PM
: I probably should have given some kind of context for this -
: Its the "advanced scripting" part of a program that reads lines from the console of a quake3 engine based game, such as "xx killed xx with a knife" or "You picked up a health pack" etc.
: What I'm looking for is the correct syntax to do stuff like "When the console says xxxx, do xxxx"
:
: Thats what those two default procedures are for, the On_LogLine one reads from the console, and the ExecETCommand one writes commands to the console.
:
: I just dont know how to use them :P
:
: Thanks anyway though.
:
:
: Any further help would be greatly appreciated <3
:

It seems, you can check the data coming in and compare it how you want. For example you could probably do this:

procedure On_LogLine(ALogLine : String);
begin
 writeln('LogLine:'+AlogLine);
 If ALogLine = 'You picked up a health pack' Then
    ExecETCommand('SpecialCommand1');
end;


Of course you would replace 'SpecialCommand1' with a command from a list that is ?probably? provided with the Pascal unit or wherever you D/L the source from.
It would get a little more complex if you wanted to intercept xxx killed xxx, because you would have to do a string search for 'killed' as the players names will always be different.

Phat Nat

Report
Re: Please help a newbie :) Posted by Ezdo on 10 Aug 2006 at 10:40 PM
: : I probably should have given some kind of context for this -
: : Its the "advanced scripting" part of a program that reads lines from the console of a quake3 engine based game, such as "xx killed xx with a knife" or "You picked up a health pack" etc.
: : What I'm looking for is the correct syntax to do stuff like "When the console says xxxx, do xxxx"
: :
: : Thats what those two default procedures are for, the On_LogLine one reads from the console, and the ExecETCommand one writes commands to the console.
: :
: : I just dont know how to use them :P
: :
: : Thanks anyway though.
: :
: :
: : Any further help would be greatly appreciated <3
: :
:
: It seems, you can check the data coming in and compare it how you want. For example you could probably do this:
:
:
: procedure On_LogLine(ALogLine : String);
: begin
:  writeln('LogLine:'+AlogLine);
:  If ALogLine = 'You picked up a health pack' Then
:     ExecETCommand('SpecialCommand1');
: end;
: 

:
: Of course you would replace 'SpecialCommand1' with a command from a list that is ?probably? provided with the Pascal unit or wherever you D/L the source from.
: It would get a little more complex if you wanted to intercept xxx killed xxx, because you would have to do a string search for 'killed' as the players names will always be different.
:
: Phat Nat
:
:


Thanks Phat Nat, thats exactly what I was looking for. Perhaps you can help with my other problem that I have posted in a new thread? :P

Ezdo



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.