Author Topic: a few questions  (Read 1327 times)

0 Members and 1 Guest are viewing this topic.

Offline chutem

  • Veteran
  • *****
  • Posts: 1119
a few questions
« on: January 23, 2008, 09:49:31 pm »
I'll get straight into it:

1. Are the functions Random() and Randomize coded into the soldat server?

2. If They aren't, how could I make a function that generates random numbers?

3. Is there a place/document that lists all the standard functions used in pascal that are included in soldat server? (for instance delay() is not supported)

4. Can you implement Delay() as a way to stop the server from processing the procedure it is in, as in, not stop the whole server and cause lag like sleep() does?

5. Can you implement a GetCursorXY(ID:Byte, X,Y: Single) function?

I think that is all, if i remember another question, I will post it.
P.S. Number 5 isn't really important, just a nice idea (at least I think it is :))
1NK3FbdNtH6jNH4dc1fzuvd4ruVdMQABvs

Offline -Snowy-

  • Major(1)
  • Posts: 44
    • Snowy
Re: a few questions
« Reply #1 on: January 24, 2008, 12:43:59 am »
1. Are the functions Random() and Randomize coded into the soldat server?
yer it is, you use Random(min result,max result)

3. Is there a place/document that lists all the standard functions used in pascal that are included in soldat server? (for instance delay() is not supported)
i use this, but im not sure how up-to-date it is

4. Can you implement Delay() as a way to stop the server from processing the procedure it is in, as in, not stop the whole server and cause lag like sleep() does?
i wouldnt mind that either

5. Can you implement a GetCursorXY(ID:Byte, X,Y: Single) function?
yeah ive thought of that one too...cant remember what for though

Offline EnEsCe

  • Retired Soldat Developer
  • Flamebow Warrior
  • ******
  • Posts: 3101
  • http://enesce.com/
    • [eC] Official Website
Re: a few questions
« Reply #2 on: January 24, 2008, 02:07:05 am »
4 and 5 are not possible.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: a few questions
« Reply #3 on: January 24, 2008, 06:25:31 am »
if you threaded all the functions, then you could use Sleep w/out freezing up the computer, although having that many threads would be unwise sense threads on the soldat server are not so stable. I personally try to stick to 0 at most. :P

Offline chrisgbk

  • Moderator
  • Veteran
  • *****
  • Posts: 1739
Re: a few questions
« Reply #4 on: January 24, 2008, 07:54:56 am »
if you threaded all the functions, then you could use Sleep w/out freezing up the computer, although having that many threads would be unwise sense threads on the soldat server are not so stable. I personally try to stick to 0 at most. :P

No, you can't; this is due to how threads work and how the scripting engine works, it's not re-entrant. Meaning that when you have multiple scripts running at the same time, it corrupts the internal state of the scripting engine. Which is why threads cause problems currently. Which is why they will always cause problems.

Unless you know how to write multi-threaded applications properly, don't assume that making something threaded magically fixes it; you have to deal with all the issues involved, and in the case of scripting, you can't solve it without replacing the script engine entirely. Or creating a new instance for each thread, but this script engine is less than ideal for such a thing, and would result in the memory usasge of the server skyrocketing.

Offline chutem

  • Veteran
  • *****
  • Posts: 1119
Re: a few questions
« Reply #5 on: January 24, 2008, 03:22:34 pm »
1. Are the functions Random() and Randomize coded into the soldat server?
yer it is, you use Random(min result,max result)

3. Is there a place/document that lists all the standard functions used in pascal that are included in soldat server? (for instance delay() is not supported)
i use this, but im not sure how up-to-date it is


Thanks for num1 but num 3 doesn't answer my question:

at the moment I have to write a script to test some functions, as they are not listed at enesce.com/help, enesce.com/help has all the soldat specific functions that are not normally in pascal, and says to learn pascal from another site for all the things like inttostr, delay(), and PutPixel, but  I don't know of anywhere that lists these unused pascal functions
1NK3FbdNtH6jNH4dc1fzuvd4ruVdMQABvs

Offline xmRipper

  • Soldat Beta Team
  • Flagrunner
  • ******
  • Posts: 742
    • Personal
Re: a few questions
« Reply #6 on: January 24, 2008, 04:39:42 pm »
Co-Founder / CTO @ Macellan
Founder Turkish Soldat Community

Offline chutem

  • Veteran
  • *****
  • Posts: 1119
Re: a few questions
« Reply #7 on: January 24, 2008, 05:00:07 pm »
*cringes at response* >_<, you're not reading my question properly,

I'll try again:

Soldat server uses pascal,

Pascal has built in functions like inttostr, delay, putpixel,

Soldat server does not support all of these functions,

Is there anywhere that lists all of the pascal functions not included or lists the functions that are included because as i have found out, some aren't e.g. delay()

1NK3FbdNtH6jNH4dc1fzuvd4ruVdMQABvs

Offline EnEsCe

  • Retired Soldat Developer
  • Flamebow Warrior
  • ******
  • Posts: 3101
  • http://enesce.com/
    • [eC] Official Website
List of non-documented Scripting functions
« Reply #8 on: January 24, 2008, 06:31:00 pm »
Code: [Select]
function inttostr(i: Int64): string;
function inttostr(i: Integer): string;
function strtoint(s: string): Longint;
function strtointdef(s: string; def: Longint): Longint;
function copy(s: string; ifrom, icount: Longint): string
function pos(substr, s: string): Longint;
procedure delete(var s: string; ifrom, icount: Longint);
procedure insert(s: string; var s2: string; ipos: Longint);
function getarraylength: integer;
Function StrGet(var S : String; I : Integer) : Char;
procedure StrSet(c : Char; I : Integer; var s : String);
Function WStrGet(var S : WideString; I : Integer) : WideChar;
procedure WStrSet(c : WideChar; I : Integer; var s : WideString);
Function StrGet2(S : String; I : Integer) : Char;
Function AnsiUppercase(s : string) : string;
Function AnsiLowercase(s : string) : string;
Function Uppercase(s : string) : string;
Function Lowercase(s : string) : string;
Function Trim(s : string) : string;
function Length(s : string) : Integer;
procedure SetLength;
function Low: Int64;
function High: Int64;
procedure Dec;
procedure Inc;
Function Sin(e : Extended) : Extended;
Function Cos(e : Extended) : Extended;
Function Sqrt(e : Extended) : Extended;
Function Round(e : Extended) : Longint;
Function Trunc(e : Extended) : Longint;
Function Int(e : Extended) : Extended;
Function Pi : Extended;
Function Abs(e : Extended) : Extended;
function StrToFloat(s: string): Extended;
Function FloatToStr(e : Extended) : String;
Function Padl(s : string;I : longInt) : string;
Function Padr(s : string;I : longInt) : string;
Function Padz(s : string;I : longInt) : string;
Function Replicate(c : char;I : longInt) : string;
Function StringOfChar(c : char;I : longInt) : string;
function Unassigned: Variant;
function VarIsEmpty(const V: Variant): Boolean;
function Null: Variant;
function VarIsNull(const V: Variant): Boolean;
function VarType(const V: Variant): TVarType;
procedure RaiseLastException;
procedure RaiseException(Ex: TIFException; Param: string);
function ExceptionType: TIFException;
function ExceptionParam: string;
function ExceptionProc: Cardinal;
function ExceptionPos: Cardinal;
function ExceptionToString(er: TIFException; Param: string): string;
function StrToInt64(s: string): int64;
function Int64ToStr(i: Int64): string;
function SizeOf: Longint;
function IDispatchInvoke(Self: IDispatch; PropertySet: Boolean; const Name: String; Par: array of variant): variant;
Happy?

Offline chutem

  • Veteran
  • *****
  • Posts: 1119
Re: a few questions
« Reply #9 on: January 24, 2008, 06:58:50 pm »
 ;D ;D ;D

Finally someone who understands!

*saves*

Thank you so much, I think you should put it in a stickie.

BTW did you just type that up, or did you have it in a file somewhere.
« Last Edit: January 24, 2008, 07:00:26 pm by chutem »
1NK3FbdNtH6jNH4dc1fzuvd4ruVdMQABvs