Official Soldat Forums

Server Talk => Scripting Discussions and Help => Topic started by: ~Niko~ on June 17, 2009, 05:01:27 pm

Title: Post here your script ideas
Post by: ~Niko~ on June 17, 2009, 05:01:27 pm
Tell me what would you like to be scripted. It will be a good practice to me. I don't know much but I guess that I will  be able to do few things. Just tell me how would your desired script be and I'll give it a try.
Title: Re: Post here your script ideas
Post by: shantec on June 18, 2009, 06:10:40 am
Chess...
Soldat ingame chess :p
Title: Re: Post here your script ideas
Post by: ~Niko~ on June 18, 2009, 06:36:40 am
That's highly not going to happen...

I am thinking on a calculator, though. And I think it will be quite easy to make :)
Title: Re: Post here your script ideas
Post by: Gizd on June 18, 2009, 06:45:55 am
Calculator is good to start. If you want bigger challenge make in-game Poker.
Title: Re: Post here your script ideas
Post by: ~Niko~ on June 18, 2009, 06:56:35 am
You have to do it all with text, so how could you do it all??
Title: Re: Post here your script ideas
Post by: koolazngy94 on June 18, 2009, 08:43:28 am
How about Gun Game?
Title: Re: Post here your script ideas
Post by: ~Niko~ on June 18, 2009, 08:46:58 am
How about Gun Game?
Explain please?
Title: Re: Post here your script ideas
Post by: LORD KILLA on June 18, 2009, 10:33:14 am
If you want, finish this formula calculator for me.
Sould be albe to calculate, for example: '3+4((6^4)+x)*360' =P or any other formula
Code: [Select]
type TVars = record
x: Double;
y: Double;
a: Double;
b: Double;
c: Double;
n: Double;
t: Double;
d: Double;
e: Double;
f: Double;
end; var vars: TVars;
lv: integer;
i: integer;

const
pi = 3.14159265358979;

function power(base: double; exp: integer): double;
var i: byte;
begin
  result := 1;
  if exp = 0 then exit;
  for i := 1 to round(abs(exp)) do result := result * base;
  if exp < 0 then result := 1 / result;
end;

function root(base: double; exp: integer): double;
var x: double; neg_exp: boolean;
begin
  if base < 0 then
    if exp mod 2 = 0 then exit;
  if exp < 0 then begin
    neg_exp := true;
    exp := -exp;
  end;
  result := 1;
  repeat
    x := result;
    result := (result * (exp - 1) + base / power(result, exp - 1)) / exp;
  until abs(x-result) < 0.0000000001;
  if neg_exp then result := 1 / result;
end;

function formula (s: string): Double; // '1+1'
var
buff: array[0..10] of Double;
num: string;
inum: Double;
iinum: Double;
nnum: Double;
pos: integer;
eofn: boolean;
eofn1: boolean;
st: string;
summ: double;
begin
num := '';
lv := 0;
for i := 1 to 10 do buff[i] := 0;
sum := 0;
for i := 1 to length(s) do begin
if (s[i]='1')or(s[i]='2')or(s[i]='3')or(s[i]='4')or(s[i]='5')or(s[i]='6')or(s[i]='7')or(s[i]='8')or(s[i]='9')or(s[i]='0')or(s[i]='.') then begin
num := num + s[i];
eofn1 := false;
WriteLn(num);
end else begin
inum := strtofloat(num);
num := '';
eofn1 := true;
end;
{ if ((s[i]='1')or(s[i]='2')or(s[i]='3')or(s[i]='4')or(s[i]='5')or(s[i]='6')or(s[i]='7')or(s[i]='8')or(s[i]='9')or(s[i]='0')or(s[i]='.')) and (eofn1) then begin
num := num + s[i];
eofn := false;
end else begin
inum := strtofloat(num);
num := '';
eofn := true;
eofn2 := true;
end; }
if eofn1 then begin
if s[i] = '(' then lv := lv + 1;
if s[i] = ')' then lv := lv - 1;
if s[i] = '+' then st  := '+';
  if s[i] = '-' then st  := '-';
if s[i] = '*' then st  := '*';
if s[i] = '/' then st  := '/';
if s[i] = '^' then st  := '^'; // 2^3 = 2³
if s[i] = 'v' then st  := 'v'; // root
end;
if eofn then begin
if st = '+' then begin
//summ := summ + inum;
Result := summ + inum;
end;
if st = '-' then begin
summ := summ - inum;
end;
if st = '*' then begin
summ := summ * inum;
end;
if st = '/' then begin
summ := summ / inum;
end;
if st = '^' then begin
summ := power(summ, inum);
end;
if st = 'v' then begin
summ := root(summ, inum);
end;
end;
end;
Result := buff[0];
end;

function onplayercommand(id:byte; text: string): boolean;
begin
if getpiece(text, ' ', 0) = '/f' then begin
WriteConsole(id, floattostr(formula(copy(text, 4, length(text)))), $EEFF00FF);
end;
end;

It has bugs, especialy: always returnt 0 :P
Title: Re: Post here your script ideas
Post by: ~Niko~ on June 18, 2009, 10:57:42 am
Quite complicated, isn't it?

All I have is a working simple calculator. It does sums, rests, multiplies and divides. (This last one, badly).
Title: Re: Post here your script ideas
Post by: DorkeyDear on June 18, 2009, 11:55:11 am
How-a-bout a simple game of checkers. It can be useful on servers with survival enabled, and your waiting to respawn, and aren't multitasking.

For the calculator, I'd like it to be easily changable. Changable as in order of operations can be modded, can remove and add operators, can change the format of the operators (instead of <left><whitespace>+<whitespace><right> have + <left> <right> for a prefix-notated calculator easily. That'll be a nice chalenge.
ActivateServer:
AddOperator(1, '\w\(.*\)', '_Parenthesis');
AddOperator(3, '(.*)+(.*)', '_Addition');
AddOperator(3, '(.*)-(.*)', '_Subtraction');
But ofc due to regex limitations, you cannot actually make it that way :P (Even if it did, the regex would definitely need to be modified)
Title: Re: Post here your script ideas
Post by: ~Niko~ on June 18, 2009, 01:50:07 pm
i thought you would ask for something easy, not this...
Title: Re: Post here your script ideas
Post by: koolazngy94 on June 18, 2009, 03:50:19 pm
Explain please?

Every player starts with Pistol. They have to get certain kills to get to the next level (gun). If someone knife someone, the person who knifed automatic go to the next level and the person who got knifed lose a level.
Title: Re: Post here your script ideas
Post by: ~Niko~ on June 18, 2009, 03:59:24 pm
Explain please?

Every player starts with Pistol. They have to get certain kills to get to the next level (gun). If someone knife someone, the person who knifed automatic go to the next level and the person who got knifed lose a level.
Pretty likely to advance mode, but it's quite different.

I'll give it a try.
Title: Re: Post here your script ideas
Post by: koolazngy94 on June 18, 2009, 04:11:10 pm
Explain please?

Every player starts with Pistol. They have to get certain kills to get to the next level (gun). If someone knife someone, the person who knifed automatic go to the next level and the person who got knifed lose a level.
Pretty likely to advance mode, but it's quite different.

I'll give it a try.

I tried to do it but I'm really bad at it lol.
Title: Re: Post here your script ideas
Post by: ~Niko~ on June 18, 2009, 04:51:51 pm
It's pointless. Just unable Chainsaw and Law, and put advance mode enabled, that's all.. no need for any script. The add of knife kills that level up seems pointless and a waste of time.
Title: Re: Post here your script ideas
Post by: LORD KILLA on June 19, 2009, 02:30:40 pm
Nah, niko.
try to make it maybe with accounts. levels are saved and you get more damage incrase with a higher level ^^
Title: Re: Post here your script ideas
Post by: danmer on June 19, 2009, 03:48:21 pm
i always wanted to make a galaga-like mod with bots paradropping on players who get different powerups from the bots they shoot down (more weapons etc); bots get tougher with time as well (get a weapon on spawn, more HP etc etc)
Title: Re: Post here your script ideas
Post by: ~Niko~ on June 19, 2009, 05:59:29 pm
Nah, niko.
try to make it maybe with accounts. levels are saved and you get more damage incrase with a higher level ^^
That kind of scripts are already made and have been forking in a few servers for months.