Author Topic: [Script Core] V3 Re-implementation and Extra Suggestions  (Read 2049 times)

0 Members and 1 Guest are viewing this topic.

Offline Tehbugerz0r

  • Soldier
  • **
  • Posts: 158
[Script Core] V3 Re-implementation and Extra Suggestions
« on: February 20, 2012, 11:59:16 am »
First of all, considering the fact that many people use enesce.com/help for scripting functions it would seem silly how it has a bunch of functions that don't exist. The change log for V3, re-ordered and modified colours to show how important they are, and with explanations, and removed things that aren't so important.

Keep in mind that as admins of a server we can already /kill players and do all sorts of things to them, so anything that might lag the server or have other interesting effects can't be disregarded. Nobody is forced to play on a server.

Red: Highest Priority
Green: Important.
Blue: add/change if possible
Navy: comment

************************
* ScriptCore Engine v3 *
************************

- Added SecAmmo stat to the GetPlayerStat function
-Returns the ammo count for their secondary weapon


- Added SetPlayerStat function
-Allows you to change player's stats easily, such as health.


- Modified OnPlayerDamage event parameters. Added Weapon
It is currently impossible to accurately get the weapon a player used to damage someone.

- Added BigTextID parameter to DrawText (after ID)
-This will allow you to have multiple drawtext events up and not overwrite standard messages.


- Added
InterfaceText function
- Added WorldText function
- Added InterfaceImage function
Added WorldImage function

I believe the WorldText and InterfaceText have already been discussed. The image functions work the same only they use an image currently loaded to soldat, such a cursor or healthbar.



- Added time function
- Added
microtime function
-I believe these were effectively delay functions, different to the sleep function because they don't cause the server to stop.

- Added OnGameEnd event to NetworkCore.pas
-This event is called when the time reaches 0 or score limit is reached (prior to OnMapChange)

- Added OnFlagDrop event to NetworkCore.pas
Triggered when player holding flag gets killed, or throws the flag.

- Added HighestID global variable
Variable that holds the ID number of the player with the highest ID.

- Added Randomize function
 Reinitialize the seed used for pseudo random numbers



- Fixed vote starting functions not working
-Dunno about this, never used, but if it's not working then it's a problem.

- Added PreProcessing to the ScriptCore Compiler. Standard directives INCLUDE, DEFINE, UNDEF, IFDEF, IFNDEF, ENDIF are supported.

- Modified ScriptCore Compiler will now display hints/warnings during compilation without requiring there to be an error as well.
-Only displaying hints/warning when there's an error is illogical.

- Added DeactivateServer event to Core.pas
Triggered when the script is terminated, for any reason.

- Added MoveFile, DeleteFile, and CopyFile functions.

- Added 'Registered' stat to GetPlayerStat function
Allows scripters to add some registered only functionality themselves  ;)

- Modified OnPlayerKill event parameters. Changed Weapon from String to Byte
Using a string is silly, better to use the number representation for weapons


End of re-implementaton suggestions from SC V3

Extra suggestions:

Change AppOnIdleTimer to used on unsafe mode.
Having to wait every second for a function is an insane limitation, and often server hosts can be unresponsive, there's easier ways to destroy a server than AOITimer.

Remove "|*|" from the start of a WriteConsole message.
It's a waste of space and is ugly.


Change GetKeyPress to be triggered while players are in spectator(if possible).

Fix GetKeyPress returning faulty values after MovePlayer and checking for "Shoot".

Seperate jet speed changes from gravity ServerModifier and add as a seperate option.
Example code:
Code: [Select]
ServerModifier('JetSpeed',-0.06)This would reverse the jets without reversing the gravity.
« Last Edit: March 23, 2012, 09:11:39 am by Tehbugerz0r »

Offline Tehbugerz0r

  • Soldier
  • **
  • Posts: 158
Re: [Script Core] V3 re-implementation and Limit Removal
« Reply #1 on: March 16, 2012, 01:52:16 am »
Updated post, 2 more suggestions:

Change AppOnIdleTimer to used on unsafe mode.
Having to wait every second for a function is an insane limitation, and often server hosts can be unresponsive, there's easier ways to destroy a server host than AOITimer. My hopes aren't high for this though.

Seperate jet speed changes from gravity ServerModifier and add as a seperate option.
Example code:
Code: [Select]
ServerModifier('JetSpeed',-0.06)This would reverse the jets without reversing the gravity.

Also you should make it possible to have script core updates without having to update Soldat and the rest of the server.
« Last Edit: March 16, 2012, 01:59:48 am by Tehbugerz0r »

Offline Falcon`

  • Flagrunner
  • ****
  • Posts: 792
  • A wanted lagger
Re: [Script Core] V3 Re-implementation and Extra Suggestions
« Reply #2 on: March 16, 2012, 04:52:23 am »
You're not the first one making posting your scriptcore wishlist. A few examples may be found here (it's even sticky!), here, here or here. They all have good ideas, too.
I don't think that I'll implement much more than the voting functions into next soldat release as scriptcore code is, as whole the rest of soldat's code, a bloody mess (however surprisingly it's the cleanest part in server, at least imo).

What comes to AppOnIdleTimer I think I've stated myself pretty clear in the devlog topic. If you really need it so much in safe mode, make a pool about it. With enough modes you may convince us to change it.

EDIT: Just reminded myself.
I've been using fast apponidle on my servers since a long time (trough modified binary in the past, now trough AppOnIdleTimer) and yes it've been working perfectly stable, especially after I've made some fixes in scriptcore code. So, what's the problem? The efficiency. With 1hz AOI the average CPU usage was on level of 1% (or even below). After we've made an use of faster AppOnIdle it stays on level of even 20% during the gameplay. You might blame me that it's probably due to the efficiency of the script itself (or in other words: my scripts sucks), but I can assure you they don't as there's three of us working on them and checking each other's code (that would be me, tk and TheOne).
And while I can afford 20% CPU usage per server (that'd be ~500MHz), some hosters may not. That's why they should've an option to limit you, the scripter.
« Last Edit: March 16, 2012, 05:03:24 am 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 Tehbugerz0r

  • Soldier
  • **
  • Posts: 158
Re: [Script Core] V3 Re-implementation and Extra Suggestions
« Reply #3 on: March 16, 2012, 09:11:28 am »
Well hopefully Soldat will bounce back and have more flexible and active hosts by the time I get interested again, and I am aware that these will not be in the next version.

I would like to know if what I mentioned before is even possible within reason though.
Quote
Also you should make it possible to have script core updates without having to update Soldat and the rest of the server.

Offline tk

  • Soldier
  • **
  • Posts: 235
Re: [Script Core] V3 Re-implementation and Extra Suggestions
« Reply #4 on: March 16, 2012, 09:13:46 am »
Don't scare them Falcon, first of all, probably we are hosting the biggest and the most complex script ever made for Soldat (and yeah, some parts of it, have not been optimized yet after switching from 1 to 60Hz AOI mode). The second thing is that it's 20%, but out of 400%! (4 cores). However I agree that fast AOI should be enabled only in safe mode. Why? I saw a lot of Soldat "scripts" people create and host on the servers. And believe me, I wouldn't like to be the owner of such server, if these scripts could use 60 times faster AOI as they normally do.
// edit
Maybe the solution should be different? Setting interval lower than for example 10 ticks would require safemode on?
« Last Edit: March 16, 2012, 09:30:15 am by tk »

Offline Tehbugerz0r

  • Soldier
  • **
  • Posts: 158
Re: [Script Core] V3 Re-implementation and Extra Suggestions
« Reply #5 on: March 16, 2012, 09:36:27 am »
// edit
Maybe the solution should be different? Setting interval lower than for example 10 ticks would require safemode on?
Actually that's a very good idea, hell, I'd be happy with minimum of 15 ticks, as none of the scripts I have made for it need it faster than that.
« Last Edit: March 16, 2012, 09:38:46 am by Tehbugerz0r »

Offline Falcon`

  • Flagrunner
  • ****
  • Posts: 792
  • A wanted lagger
Re: [Script Core] V3 Re-implementation and Extra Suggestions
« Reply #6 on: March 16, 2012, 10:27:41 am »
It's still 500MHz per server tk, now hosting even 20 of with 10 "heavily  scripted" and active at the same time would give you 5GHz of cpu consumption.
But, back to the first post:
- SecAmmo is already added, along with ForceWeaponEx allowing to set secondary ammo
- SetPlayerStat is kind of, in progress
- For a weapon parameter, i'll see what i can do
- Big text won't be added in next revision for sure, possibly later though
- Same goes for all the interface/world text functions

- All the green requests besides HighestID, Randomize and all the lower ones shouldn't be a problem. First because... soldat doesn't have any HighestID internally (sad, but true), for the 2nd one try to find mersenne twister rng on this forums.

- Voting functions are fixed
- Preprocessor may be added in next release, but that's not sure.
- All the others may be added later.

What comes to getkeypress i don't think that fixing them is easy, so don't expect them to be included/fixed soon. Same goes for jets modifier.
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 Tehbugerz0r

  • Soldier
  • **
  • Posts: 158
Re: [Script Core] V3 Re-implementation and Extra Suggestions
« Reply #7 on: March 23, 2012, 09:22:23 am »
Lack of those text functions will probably be a disappointment for everybody.
Does the client even send any information about button presses to the server while in spectator?
Also, I see no reason how the jet modifier could take any longer than few minutes, jet speed is separate from gravity.

Offline Falcon`

  • Flagrunner
  • ****
  • Posts: 792
  • A wanted lagger
Re: [Script Core] V3 Re-implementation and Extra Suggestions
« Reply #8 on: March 23, 2012, 02:15:54 pm »
Also, I see no reason how the jet modifier could take any longer than few minutes, jet speed is separate from gravity.

Of course it's not. You think that enesce would make gravity change jets speed on purpose?
« Last Edit: March 23, 2012, 02:17:54 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 Tehbugerz0r

  • Soldier
  • **
  • Posts: 158
Re: [Script Core] V3 Re-implementation and Extra Suggestions
« Reply #9 on: March 24, 2012, 02:45:09 am »
Edit: What the? Preview button sent the post??? Guess I'll have to rewrite the message I just sent.

Also, I see no reason how the jet modifier could take any longer than few minutes, jet speed is separate from gravity.

Of course it's not. You think that enesce would make gravity change jets speed on purpose?

No... It wasn't a question, it was a statement. When I am asking a question you'll know when I use a question mark. So I guess you have a similar answer to my actual question?
« Last Edit: March 24, 2012, 02:51:58 am by Tehbugerz0r »

Offline Falcon`

  • Flagrunner
  • ****
  • Posts: 792
  • A wanted lagger
Re: [Script Core] V3 Re-implementation and Extra Suggestions
« Reply #10 on: March 24, 2012, 05:02:42 am »
I don't need you to ask a question in order to correct you, do I?
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 Tehbugerz0r

  • Soldier
  • **
  • Posts: 158
Re: [Script Core] V3 Re-implementation and Extra Suggestions
« Reply #11 on: March 25, 2012, 07:36:05 am »
How was that correcting? All you were doing was confirming what I said was true, and now ignoring all my other questions. A proper answer would have been why it's hard to have them change separately.
« Last Edit: March 25, 2012, 07:47:50 am by Tehbugerz0r »

Offline Falcon`

  • Flagrunner
  • ****
  • Posts: 792
  • A wanted lagger
Re: [Script Core] V3 Re-implementation and Extra Suggestions
« Reply #12 on: March 25, 2012, 08:45:55 am »
Also, I see no reason how the jet modifier could take any longer than few minutes, jet speed is separate from gravity.

Of course it's not. You think that enesce would make gravity change jets speed on purpose?

Longer version: "Obviously, jets speed IS connected to game's gravity factor. You can conclude that from ServerModifier('Gravity') behavior. When you change gravity trough that function, it affects also jets speed. Now, assuming that the function internally is made in simplest way possible (hint: it is), you can conclude that jets speed IS related to gravity factor.

Does it answer your question already or do I have to write an even longer explanation?
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 Tehbugerz0r

  • Soldier
  • **
  • Posts: 158
Re: [Script Core] V3 Re-implementation and Extra Suggestions
« Reply #13 on: March 26, 2012, 01:08:36 am »
Oh so you were saying they ARE connected, I got confused. I thought you were just repeating what I was by saying they were separate. This still seems conflict with some tests of mine, but I guess I was wrong.

So they're effectively in a big tangle that would take a while to undo.

Still, what about allowing AppOnIdleTimer to work off safe mode but prevent it from going faster than once every 30 ticks?
« Last Edit: March 26, 2012, 01:11:05 am by Tehbugerz0r »