Official Soldat Forums

Server Talk => Scripting Discussions and Help => Topic started by: chutem on January 23, 2008, 09:49:31 pm

Title: a few questions
Post by: chutem 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 :))
Title: Re: a few questions
Post by: -Snowy- 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 (http://enesce.com/help/), 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
Title: Re: a few questions
Post by: EnEsCe on January 24, 2008, 02:07:05 am
4 and 5 are not possible.
Title: Re: a few questions
Post by: DorkeyDear 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
Title: Re: a few questions
Post by: chrisgbk 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.
Title: Re: a few questions
Post by: chutem 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 (http://enesce.com/help/), 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
Title: Re: a few questions
Post by: xmRipper on January 24, 2008, 04:39:42 pm
http://www.delphibasics.co.uk
Title: Re: a few questions
Post by: chutem 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()

Title: List of non-documented Scripting functions
Post by: EnEsCe 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?
Title: Re: a few questions
Post by: chutem 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.