0 Members and 2 Guests are viewing this topic.
//whenever someone does a commandprocedure OnPlayerCommand(ID: Byte; Text: string);var halves: array of string;begin //what the person's command was, seperated by /me's halves := Explode(Text, '/me'); //more than two items causes problems if getarraylength(halves) > 2 then exit; //write it out! WriteConsole(0, IDToName(ID)+halves[1], $FFffcccc);end;
lol niceno slapping people around a bit with large tunas?
Can't you just substr with Copy?
Yeah looking at the source it seems this should be a lot simpler.Quote from: mar77a on August 06, 2008, 04:15:31 pmCan't you just substr with Copy?I don't think there is a substr in the scripting core.Instead I would do if GetPiece(Text,' ',0) = '/me' to check the first bit, and I dunno about the rest.
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): stringfunction 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;function GetTickCount():Cardinal