Author Topic: Script Core Suggestions  (Read 86155 times)

0 Members and 2 Guests are viewing this topic.

DarkCrusade

  • Guest
Re: Script Core Suggestions
« Reply #220 on: May 19, 2013, 06:37:09 am »
Something to be changed:

Code: (pascal) [Select]
procedure dec(var X: integer; N: integer);
procedure inc (var X: integer; N: integer);

It would be great if this could be used for bytes as well, and maybe even singles. That way, a lot of unnecessary code could be prevented.

Code: (pascal) [Select]
From: player[i].mine[ii].tleft:=player[i].mine[ii].tleft-1;
To: dec(player[i].mine[ii].tleft,1);

It looks much better, is readable with ease, and requires less code in moments where you want to use a byte and not an integer.
« Last Edit: May 19, 2013, 11:27:05 am by DarkCrusade »

Offline Shoozza

  • Retired Soldat Developer
  • Veteran
  • ******
  • Posts: 1632
  • Soldat's Babysitter
    • Website
Re: Script Core Suggestions
« Reply #221 on: May 19, 2013, 10:48:02 am »
Let's keep it compatible to the normal Delphi/Object Pascal implementation (so no floating point inc/dec):
http://www.delphibasics.co.uk/RTL.asp?Name=Inc

Quote from: delphibasics.co.uk
You can increment :
 
Characters    
Non-floating number types    
Enumeration types    
Pointers

I think you can drop the ",1" just do Dec(varname); or Inc(varname);
Rules
Tools: ARSSE - SARS - SRB - chatMod

Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: Script Core Suggestions
« Reply #222 on: May 19, 2013, 05:07:47 pm »
Do a _dec(input: variant), and you should be fine to go. :p
www.soldatx.com.br - The brazilian Soldat community.

DarkCrusade

  • Guest
Re: Script Core Suggestions
« Reply #223 on: May 22, 2013, 02:08:05 am »
More suggestions to the scriptcore:

Code: (pascal) [Select]
procedure servermodifier(name:string; id:byte; value:variant);
servermodifier('gravity',3,0.03); // Only player 3 is affected.
servermodifier('gravity',255,0.03); // The entire server is affected.

It certainly has been suggested before, but this would be so great..

Code: (pascal) [Select]
procedure changeweaponstats(id,weaponid:byte; dmg,interval,ammo,reload,style,startup,bink,movacc,recoil:integer);
// ID = 255 changes the weapon for everyone.

A feature like this would open new ways for scripting to affect gameplay. There could be servers with one weapon setting for every team, new possibilities for RPGs and so much more!

Code: (pascal) [Select]
procedure writeini(filename,section,key:string; value:variant);

I really miss this feature.

Offline Falcon`

  • Flagrunner
  • ****
  • Posts: 792
  • A wanted lagger
Re: Script Core Suggestions
« Reply #224 on: May 22, 2013, 05:26:34 am »
Two last are on the way... more or less. I hope i'll finish it before the next devlolg.
First one requires netcode change, so i think maybe in next release. I actually miss that too, but this is a very complex case, because you need not only handle the player himself, but also his bullets, grenades, deicde what gravity to apply to his weapon after he dies and so on.
If you're not paying for something, you're not the customer; you're the product being sold.
- Andrew Lewis

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

DarkCrusade

  • Guest
Re: Script Core Suggestions
« Reply #225 on: May 22, 2013, 08:11:44 am »
A couple more suggestions:

Code: (pascal) [Select]
function weaponnumbyname(name:string):byte;
a:=weaponnumbyname('Steyr AUG'); // a = 4;

'onplayerkill' gives me a string, but only numbers matter when you use arrays for weapon stats for example.

Code: (pascal) [Select]
procedure movebot(id:byte; x,y:single);
I want to be able to move bots around the map. It's already possible, I know that. But it's a real pain to go through this much code and have these 'kicked bot xyz' and 'added bot xyz' messages flood the server just to move a bot from one place to another. Please save us the time and energy [pigtail]

Code: (pascal) [Select]
a:=function addbot(id:byte; x,y:single):byte; // a = bot's ID
Similiar to the above suggestion, it'd be a nice feature that I would not want to miss once implemented. If you consider addming movebot() to the scriptscore, then forget about this suggestion. Of course, if you were to add both, who am I to stop you? :) It definetly has its uses.

Edit: Oh, and it would be awesome if you could work on Soldatserver. For example, it would be nice if there was a full list of bugs displayed in the logs, or a plugin for Notepad++ including Soldat's scriptcore.

Edit2: It would also be really awesome if we could use 'getplayerstat(id,'active')' without '=true'.. :|
« Last Edit: May 22, 2013, 10:13:39 am by DarkCrusade »

Offline SyavX

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 338
Re: Script Core Suggestions
« Reply #226 on: May 22, 2013, 08:12:31 am »
Since there already are IDToIP / IPToID and IDToName / NameToID functions you could add:
Code: [Select]
function IDToHWID(ID: integer): string
function HWIDToID(HWID: string): string;

function NameToHWID(Name: string): string;
function HWIDToName(HWID: string): string;

function IPToHWID(Name: string): string;
function HWIDToIP(HWID: string): string;

Offline Falcon`

  • Flagrunner
  • ****
  • Posts: 792
  • A wanted lagger
Re: Script Core Suggestions
« Reply #227 on: May 22, 2013, 02:29:54 pm »
Code: [Select]
Script.AddFunction(@NameToHW, 'function NameToHW(A: string): string');
Script.AddFunction(@IDToHW, 'function IDToHW(Id: Byte): string');

I don't know who added these, certainly not me, so i guess they're there for some time already.
If you're not paying for something, you're not the customer; you're the product being sold.
- Andrew Lewis

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

Offline JotEmI

  • Soldier
  • **
  • Posts: 188
Re: Script Core Suggestions
« Reply #228 on: May 22, 2013, 07:49:26 pm »
... or a plugin for Notepad++ including Soldat's scriptcore.

http://forums.soldat.pl/index.php?topic=40110.msg492742#msg492742
Here you have my auto-completion file for Notepad++. It's for the ScriptCore v2.6.5 but I plan to update it once the new version is out.

DarkCrusade

  • Guest
Re: Script Core Suggestions
« Reply #229 on: May 26, 2013, 10:16:34 am »
@JotEmI: Thanks for the link. :)

@Falcon: How about..

Code: (pascal) [Select]
procedure createFolder(name:string);
function folderExists(name:string):boolean;

Offline Falcon`

  • Flagrunner
  • ****
  • Posts: 792
  • A wanted lagger
Re: Script Core Suggestions
« Reply #230 on: May 26, 2013, 10:29:41 am »
you can use FileExists as folder is in fact a special type of file. At least under linux, but i take a wild guess it'll work under windows as well.
If you're not paying for something, you're not the customer; you're the product being sold.
- Andrew Lewis

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

DarkCrusade

  • Guest
Re: Script Core Suggestions
« Reply #231 on: May 31, 2013, 03:03:15 pm »
Good tip. When I tried it using the below code, it returned a 'false' statement.

Code: (pascal) [Select]
procedure activateserver();
begin
 if (fileexists('maps/')) or (fileexists('maps\')) then writeln('  * EXISTS') else writeln('  * DOES NOT EXIST');
end;

An addition to my earlier post are:

Code: (pascal) [Select]
procedure deleteFile(name:string);
procedure moveFile(name,newdir:string);

EDIT: Change "procedure onjointeam(id,team:byte);" to "function onjointeam(id,team:byte):boolean; true = allowed; false = stays in his team"

Code: [Select]
procedure onjointeam(id,team:byte); -> function onjointeam(id,team:byte:boolean;
onjointeam() = true = allowed to join the team

Code: [Select]
global var highestID -> holds the highest present ID on the server.

Offline Falcon`

  • Flagrunner
  • ****
  • Posts: 792
  • A wanted lagger
Re: Script Core Suggestions
« Reply #232 on: May 31, 2013, 06:18:47 pm »
both move and delete are implemented.
OnJoinTeam, i'll think about it.
HighestID is.. *cough* not implemented anywhere in server's code. All loops are from 1 to 32..
Can you please wait with your suggestions until rc2 is released? There are a lot of changes in that version.

For your code above, try FileExists('maps')
« Last Edit: May 31, 2013, 06:28:23 pm by FalconPL »
If you're not paying for something, you're not the customer; you're the product being sold.
- Andrew Lewis

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Script Core Suggestions
« Reply #233 on: June 02, 2013, 08:20:18 am »
Regarding OnJoinTeam event returning a boolean, it may be better to have false mean allowed, and true mean stay in team. This way false is the default behaviour; there will be a less change of a scripter accidentally forgetting to set the result to true. Similarly, OnCommand result as false means to accept the command, the default behaviour, whereas true would mean to deny the command.

I think (although not 100% certain) FileExists only works with files, and not directories.

Offline Moroes

  • Soldier
  • **
  • Posts: 165
    • Soldat-Game.eu
Re: Script Core Suggestions
« Reply #234 on: June 02, 2013, 09:08:58 am »
Is the OnFlagDrop already implemented?
Thanks :)

Offline dominikkk26

  • Camper
  • ***
  • Posts: 404
    • PMGsite
Re: Script Core Suggestions
« Reply #235 on: June 19, 2013, 01:08:55 pm »
procedure OnTeamWin(ID: byte; Team: integer);
procedure OnTeamLose(ID: byte; Team: integer);

If a player is in the team, for example, bravo - this team which is lose or win this procedure is called.
Please to be invoked immediately before the map.


Offline Falcon`

  • Flagrunner
  • ****
  • Posts: 792
  • A wanted lagger
Re: Script Core Suggestions
« Reply #236 on: June 19, 2013, 02:14:07 pm »
there's OnGameEnd already(). You can check who won by comparing team's score with max score.
If you're not paying for something, you're not the customer; you're the product being sold.
- Andrew Lewis

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

Offline dominikkk26

  • Camper
  • ***
  • Posts: 404
    • PMGsite
Re: Script Core Suggestions
« Reply #237 on: June 20, 2013, 02:09:51 pm »
I understand you. However, the new features are designed to also facilitate our work.

Offline Falcon`

  • Flagrunner
  • ****
  • Posts: 792
  • A wanted lagger
Re: Script Core Suggestions
« Reply #238 on: June 20, 2013, 04:51:08 pm »
Please learn english instead of using google translate because i cannot understand you.
If you're not paying for something, you're not the customer; you're the product being sold.
- Andrew Lewis

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

DarkCrusade

  • Guest
Re: Script Core Suggestions
« Reply #239 on: June 20, 2013, 11:44:57 pm »
He explained that he wanted this suggestion, for it would make scripting easier on the part of the coders in the community. It still makes no sense, but that's what he / she / it said.