Official Soldat Forums

Server Talk => Scripting Discussions and Help => Topic started by: Flippeh on November 27, 2007, 10:18:31 am

Title: [Suggestion] Extending GetPlayerStat, and some more.
Post by: Flippeh on November 27, 2007, 10:18:31 am
So, i would like to see a new value for GetPlayerStat, being State

Returns...
1 if player is moving
2 if player is standing
3 if player is crouching and not moving
4 if player is crouching AND moving (the 1 of moving added to the 4 of crouching)
5 if player is lying around
6 if player is lying and moving (again, 1 of moving added to the 5 of prone)

(This looks ugly, but found no better way)

Also some more procedures..

DropWeapon(ID: Byte); - Makes player with ID drop his weapon
CancelVote(); - Cancels the current kick/map vote
AcceptVote(); - Accepts the current kick/map vote, without avaiting the results
StartVoteKick(Target, Caller: ID; Reason: String); - Starts a kick vote against Target, in the name of Caller (If Caller = 255 then the caller's nick is Server)
StartVoteMap(Caller: ID; Map: String); - Starts a map vote for Map, in the name of Caller (Again, if Caller = 255 then its the Server)

And maybe some events?

procedure OnVoteMap(Caller: ID; Map: String); - Fires when someone votes a map, where Caller is the player who votes and Map is the map being voted
procedure OnVoteKick(Target, Caller: ID; Reason: String); - Fires when someone vote-kicks someone. Caller is the voter, Target is the voted one and Reason is the reason for the vote.


I suggested some of that in enesces forums, before, but i this Thread never got attention (or i forgot about it already ;x)

I am pretty sure that not everything can be implemented, but i would sure like the vote events and procedures in.
Title: Re: [Suggestion] Extending GetPlayerStat, and some more.
Post by: BombSki on November 27, 2007, 11:55:33 am
agreed. vote procedures are needed.
custom votes would even be cooler, something like
StartVote
OnVoteEnd

you can already start a mapvote with "/votemap for admin console" script.
Title: Re: [Suggestion] Extending GetPlayerStat, and some more.
Post by: Flippeh on November 27, 2007, 01:19:46 pm
Oh, i just noticed there are already StartVoteMap and StartVoteKick ;o
Now only CancelVote and AcceptVote, aswell as the events, and i am happy :>

Nice to see agreements :)

Custom votes are a really nice idea, too.
I'd define them as

procedure StartVote(Poll: String; Caller, VoteID: Byte);
procedure OnVoteEnd(VoteID, YesNum, NoNum: Byte);
Title: Re: [Suggestion] Extending GetPlayerStat, and some more.
Post by: BombSki on November 27, 2007, 01:46:08 pm
if those are gonna be added you should be able to edit 'yes' and 'no' into something else (eg vote for respawntime 3 or 4)
Title: Re: [Suggestion] Extending GetPlayerStat, and some more.
Post by: spkka on November 27, 2007, 04:12:15 pm
DropWeapon(ID: Byte); - Makes player with ID drop his weapon
can be done by scripting imo.

Two other suggestions:
- procedure SetWaypointStat(ID: byte; X, Y: single);
- procedure SetTeamDeaths(Team: byte; Deaths: integer);

^^
Title: Re: [Suggestion] Extending GetPlayerStat, and some more.
Post by: DorkeyDear on November 27, 2007, 05:01:35 pm
- procedure SetWaypointStat(ID: byte; X, Y: single);
Probably something more like:
GetWaypointStat(ID: byte; Stat: string): variant;
SetWaypointStat(ID: byte; Stat: string; Value: variant);
Stats being:
X, Y: single;
Constraint: array of byte; (for determining which waypoints this waypoint is connected to)
Up, Down, Left, Right, Jet: array of boolean; (each connection gets boolean directions)
Wait: array of byte; (you can set a certain wait time in maps..)
Style: byte; (either path 1 or 2)
Title: Re: [Suggestion] Extending GetPlayerStat, and some more.
Post by: Flippeh on November 27, 2007, 06:09:07 pm
Oh, i have another idea:

CreateExplosion(X, Y, Owner: Byte; Radius, Damage: Integer);

Creates an explosion at the given coordinates with the given strenght and radius. Kills made by the explosion will be given to the owner

I tried hard to create an explosion, but its impossible. I can't create an explosion on myself with CreateBullet (m79 bullet either drops right through me, or explodes way under me). Also CreateBullet can not explode in the air :/
Title: Re: [Suggestion] Extending GetPlayerStat, and some more.
Post by: Kavukamari on November 27, 2007, 09:06:18 pm
this is practically turning into another scripting engine suggestions thread! yay!

function TransferFile(ID: Byte; FileName, SaveName: string; OnExcept: integer):integer;

(forces ID to download FileName (FileName and SaveName MUST HAVE EXTENTION!!!), saves file as SaveName, and if there is an unhandled exception, does choice for OnExcept, Returns download state)
(if ID = 0 then all players download file)

OnExcept values:
0: cancel transfer
1: add number at end of SaveName (before extention)
2: I dunno...

results:
unknown exception: 0
transfer sucessful: 1
already exists: 2
connection broken: 3

stuff that would be cool:
procedure UseFile(FileName: string);
procedure PlaySound(FileName: string);
procedure CreateSpark(FileName: string);
procedure SetPlayerStat(ID: byte; Stat: string; NewValue: variant);


(create spark and play sound would most likely have more params)

another idea:

procedure WriteClientFile(ID: byte; FileName, WriteString: string);
function ReadClientFile(ID: byte; FileName: string):string;

(just like WriteFile() and ReadFile() except with ID's file)
(if ID = 0 then does to all players)

function ExecString(Code: string):variant;

(executes a string in soldatserver (IE: if variable 'woot' = 'KickPlayer(1)' then server will kick player 1))
(if Code has a result, the Result will be what the code returns)

function SetVar(VarName: string; NewValue: variant):string;
(Sets variable and returns variable type ('string' 'integer' 'boolean' etc)
(NEWVALUE MUST BE SAME VAR TYPE)

also: maybe change CreateBullet() into a function, and return a bullet ID for a:
procedure KillBullet(ID: byte);
(kills a bullet, good for, eerm.. getting rid of those dangerous projectiles wizzin past yer head)
(ID = 0 for all bullets)

function GetBulletStat(ID: byte; Stat: string):variant;
(gets a bullet's stat, good for finding bullets in mid-flight and adding more :) )

procedure SetBulletStat(ID: byte; Stat: string; NewValue: variant);
(sets a bullet's stat, good for changing those pellets shot from your spas into m79 nades :) )
(ID = 0 for all bullets)

function GetBulletCount(ID: byte):integer;
(gets total bullet Count made by ID (0 = all players, 255 = server(made using CreateBullet)))

procedure SetBulletCount(ID: byte; NewValue: integer);
(sets total bullet count of ID (0 = all players, 255 = server) (almost completely useless))

procedure ResetBulletCount(ID: byte);
(resets total bullet count made by ID (0 = all players, 255 = server)

(and maybe add a:
function OnNewBullet(Shooter, BID: byte; Amount: integer):boolean;
where if you returned true you would kill the new bullet(s)
(I think this would only be called every tick or something, to prevent server l     a          g

Date Posted: November 27, 2007, 08:48:28 pm
So, i would like to see a new value for GetPlayerStat, being State

Returns...
1 if player is moving
2 if player is standing
3 if player is crouching and not moving
4 if player is crouching AND moving (the 1 of moving added to the 4 of crouching)
5 if player is lying around
6 if player is lying and moving (again, 1 of moving added to the 5 of prone)

7 if player is jetting
8 if player is jetting and moving (yet again, 1 of moving added to the 7 of jet)


finally I get all of my ideas out there! anyone like them?
Title: Re: [Suggestion] Extending GetPlayerStat, and some more.
Post by: EnEsCe on November 27, 2007, 10:03:22 pm
You guys are living in a dream world
Title: Re: [Suggestion] Extending GetPlayerStat, and some more.
Post by: Kavukamari on November 27, 2007, 10:11:20 pm
I know T.T

btw: is there ANYTHING possible about any of my suggestions?

(I'm hoping for the write/read client file's and execstring and setvar)
Title: Re: [Suggestion] Extending GetPlayerStat, and some more.
Post by: BombSki on November 28, 2007, 01:37:51 am
lol. the scriptcore suggestion threads was closed. gtf out of here with anything thats offtopic (that means, anything that is not related to something that was posted in the first post)
custom votes ftw.
Title: Re: [Suggestion] Extending GetPlayerStat, and some more.
Post by: Flippeh on November 28, 2007, 01:34:06 pm
(I'm hoping for the write/read client file's and execstring and setvar)

Would be a security risk. Server could like inject code in the soldat.exe, change players profiles, reset keys, ...
Title: Re: [Suggestion] Extending GetPlayerStat, and some more.
Post by: EnEsCe on November 29, 2007, 09:08:54 am
btw: is there ANYTHING possible about any of my suggestions?

(I'm hoping for the write/read client file's and execstring and setvar)
Most of them are possible, such as sounds (I am already experimenting with it), CreateSpark can be done but in the client sparks are identified by ID's not filenames, and ID's change, so there is no way for the server/script to know which ID is currently assigned to the client's spark (eg: one second smoke puff is ID 23, then its 11 etc).
Set*Stat etc wont work because updating them server-side does not affect them client-side, causing desynchronization.
ExecString is not possible with the engine.
WriteFile/ReadFile on client is possible, but opens a few security/sanity problems. I may consider adding the possibility to write/read to an INI file within the /downloads/ folder in the Soldat client; with size/content limits.
SetVar is pointless.

Thats about it.
Title: Re: [Suggestion] Extending GetPlayerStat, and some more.
Post by: Avarax on November 29, 2007, 10:32:12 am
SetVar is not pointless as it allows way faster debugging and testing of scripts. Would allow coding ingame commands such as "/setvar insertglobalvariablenamehere value" to test a certain function of a script under very varying conditions, without having to change the whole script for the testing.
Title: Re: [Suggestion] Extending GetPlayerStat, and some more.
Post by: Kavukamari on November 29, 2007, 12:46:15 pm
WriteFile/ReadFile on client is possible, but opens a few security/sanity problems. I may consider adding the possibility to write/read to an INI file within the /downloads/ folder in the Soldat client; with size/content limits.

maybe make it so script makers cannot edit .ini's unless they make them themselves (not default .ini's)

btw, is the TransferFile() possible?

(maybe playsound could be like this:
procedure PlaySound(FileName: string; Volume: integer; Radius: single);
where volume is how loud it is (from 1 to 100) and radius is how far the sound travels (where 1.0 is one screen and 0.5 is half a screen and 2.0 is two screens))
Title: Re: [Suggestion] Extending GetPlayerStat, and some more.
Post by: chutem on December 05, 2007, 11:47:26 pm
Thats like ambient sounds, new dimension to maps:

You could have the sound of a car idling, machinery clanking, forest sounds and other cool stuff :P
Title: Re: [Suggestion] Extending GetPlayerStat, and some more.
Post by: BombSki on December 06, 2007, 02:10:37 am
yea... who wouldnt want that......
Title: Re: [Suggestion] Extending GetPlayerStat, and some more.
Post by: Kavukamari on December 06, 2007, 12:37:49 pm
a little change to PlaySound:

function PlaySound(FileName: string; Delay: integer; Volume: integer; Radius: single):integer;
added delay, so sounds don't overlap (but if delay=0 then sound doesn't end) (and crossed out volume)

procedure StopSound(SID: integer);
ends sound (SID is the number the PlaySound function returns)

procedure PauseSound(SID: integer);
pause the sound at current point

procedure ContSound(SID: integer);
continues a paused sound (ignores if sound was already playing

procedure RestartSound(SID: integer);
restarts SID from beginning

procedure JumpSound(SID: integer; Time: integer);
skips an already playing sound to Time (like if you wanted to play the file from 60 seconds)

function GetSoundStat(SID: integer; Stat: string);
stats:
Length: how long sound is (effected by Delay)
LengthM: length in millisec's
Time: Current time out of length the sound is currently at
X,Y: gets x or y
Radius: radius :P
Name: name of file sound is playing from

(damn, I'm getting out of control with ideas again O.o sorry)