Jump to content
Sign in to follow this  
djkrose

A16 - djkrose's Scripting Mod

Recommended Posts

Dj is loaded , on screenshot can see all information:

dj.thumb.jpg.17fd179755103c1dd03a121464ac5124.jpg

 

Script exist:

dj2.jpg.0b60958e3edf555a607c968011907090.jpg

 

Copy from log and all look ok, only lua is ignored:

2017-11-14T01:30:44 39.122 INF [sCRIPTING MOD] Initializing djkrose's Scripting Mod ...

2017-11-14T01:30:44 39.237 INF [sCRIPTING MOD] Persistent data loaded from ScriptingModPeristentData.xml.

2017-11-14T01:30:44 39.285 INF [sCRIPTING MOD] Patching zombie corpse item dupe exploit ...

2017-11-14T01:30:44 39.400 INF [sCRIPTING MOD] All enabled runtime patches were applied.

2017-11-14T01:30:44 39.415 INF [sCRIPTING MOD] Script file inspect.lua is ignored because it does not contain a command name definition.

2017-11-14T01:30:44 39.445 INF [sCRIPTING MOD] Registered command "js-minibike^M" in script js-minibike.js.

2017-11-14T01:30:44 39.447 INF [sCRIPTING MOD] Registered command "js-sleepers^M" in script js-sleepers.js.

2017-11-14T01:30:45 40.193 INF [sCRIPTING MOD] Registered command "js-test^M" in script js-test.js.

2017-11-14T01:30:45 40.196 INF [sCRIPTING MOD] Registered command "js-variables^M" in script js-variables.js.

2017-11-14T01:30:45 40.262 INF [sCRIPTING MOD] Registered command "lua-test^M" in script lua-test.lua.

2017-11-14T01:30:45 40.268 INF [sCRIPTING MOD] Monitoring of script folder changes activated.

2017-11-14T01:30:45 40.275 INF [sCRIPTING MOD] Done initializing djkrose's Scripting Mod.

 

 

Can try dj-version to see if the mod is loaded at all?

 

Then you can have a look into the server log at start-up. The mod logs out a lot of status messages, all tagged with "[sCRIPTING MOD]". If a script is loaded, or cannot be loaded or is ignored for any reason, it would say so in the log.

 

There were reports that different line endings on Linux could cause troble, but I believe that was only for Lua scripts...

 

Just check in the scripts folder below the ScriptingMod directory if the js-sleepers.js script is there and the content loks alright. If in doubt, get a fresh copy.

 

djk

Edited by war4head
add copy of log (see edit history)

Share this post


Link to post
Share on other sites
Dj is loaded , on screenshot can see all information:

[ATTACH=CONFIG]23324[/ATTACH]

 

Script exist:

[ATTACH=CONFIG]23325[/ATTACH]

 

Copy from log and all look ok, only lua is ignored:

2017-11-14T01:30:44 39.122 INF [sCRIPTING MOD] Initializing djkrose's Scripting Mod ...

2017-11-14T01:30:44 39.237 INF [sCRIPTING MOD] Persistent data loaded from ScriptingModPeristentData.xml.

2017-11-14T01:30:44 39.285 INF [sCRIPTING MOD] Patching zombie corpse item dupe exploit ...

2017-11-14T01:30:44 39.400 INF [sCRIPTING MOD] All enabled runtime patches were applied.

2017-11-14T01:30:44 39.415 INF [sCRIPTING MOD] Script file inspect.lua is ignored because it does not contain a command name definition.

2017-11-14T01:30:44 39.445 INF [sCRIPTING MOD] Registered command "js-minibike^M" in script js-minibike.js.

2017-11-14T01:30:44 39.447 INF [sCRIPTING MOD] Registered command "js-sleepers^M" in script js-sleepers.js.

2017-11-14T01:30:45 40.193 INF [sCRIPTING MOD] Registered command "js-test^M" in script js-test.js.

2017-11-14T01:30:45 40.196 INF [sCRIPTING MOD] Registered command "js-variables^M" in script js-variables.js.

2017-11-14T01:30:45 40.262 INF [sCRIPTING MOD] Registered command "lua-test^M" in script lua-test.lua.

2017-11-14T01:30:45 40.268 INF [sCRIPTING MOD] Monitoring of script folder changes activated.

2017-11-14T01:30:45 40.275 INF [sCRIPTING MOD] Done initializing djkrose's Scripting Mod.

 

All scripts are registered with an addition. ^M should not be there i think. You might wanna check the header of the scripts where the name is defined.

 

Cheers

 

-edit- or try calling it like its registered. With ^M at the end.

Edited by Prisma501 (see edit history)

Share this post


Link to post
Share on other sites

I was asked by a few people what my fix for the corpse dupe exploit is. Well, this is basically it:

 

In class EntityZombie:

 

fixd9buu.png

 

The problem is that "isUserAccessing()" doesn't work on multiplayer, because the client never tells the server when it opens the corpse. So my fix checks if the corpse was opened (not "untouched" anymore) and if so, it empties it's content before the gore block is created. Without this, the "CopyLootContainerDataFromOther" would here just copy (aka duplicate) whatever is in the zombie corpse.

 

Why doesn't TFP just add this?

It's not a perfect fix. If a player just opens a corpse and then closes it (unsure whether to loot, or he wants to leave it for a friend) then the loot is still emptied when the corpse turns into a gore block. While I would always prefer an imperfect fix over a duple exploit, I can see why TFP is hesitent to patch it like this. Doing it right would take much more effort, because the client-server communication would need to be changed, possibly putting more load on the server.

 

djk

Share this post


Link to post
Share on other sites

alwaysnoone

All scripts are registered with an addition. ^M should not be there i think. You might wanna check the header of the scripts where the name is defined.

 

Cheers

 

-edit- or try calling it like its registered. With ^M at the end.

 

Prisma is right, the commands are registered with an extra "^M" at the end apparently. This is due to the different newline characters on Linux as mentioned before.

 

I don't think calling the command with literally "^M" at the end works, because it's just a placeholder for the actual \n (ASCII 10) character that Windows is using for line endings but Linux isn't.

 

This is already on my fix list, but to get the scripts working on Linux you would need to convert them to Linux line endings.

 

I don't know how that could be done on Linux (anyone an idea?). Try to open the script in a Linux text editor and save it again. Or if you transferreed the files via FTP, use ASCII mode to transfer the .js files.

 

djk

 

Edit: Or ask @alwaysnoone - on page 6 he mentioned that he corrected the line endings.

Edited by djkrose (see edit history)

Share this post


Link to post
Share on other sites

ScriptingMod v0.14 - Download

 

This release contains a new repair mode that fixes bugged trees automatically. I mean those trees that have zero HP but still don't fall, but instead give a big chunk of wood on every hit, thus being considered an exploit.

 

As with all repair modes, it can be executed one-time or run repeatedly in the background.

One-time repair:

dj-repair t

 

Activate/deactivate auto-repair mode every 10 minutes:

dj-repair t /auto

 

Just check without repairing anything:

dj-repair t /sim

 

It will let you know in the server log if and how many bugged trees were found and repaired.

 

See help dj-repair for details on this and all the other repair modes.

 

djkrose

Edited by djkrose (see edit history)

Share this post


Link to post
Share on other sites

I try call commands with ^M but not work., also try load scrupt in nano linux editor and don't see any problem with newline, something else is wrong but I don't know what.

 

alwaysnoone

 

Prisma is right, the commands are registered with an extra "^M" at the end apparently. This is due to the different newline characters on Linux as mentioned before.

 

I don't think calling the command with literally "^M" at the end works, because it's just a placeholder for the actual \n (ASCII 10) character that Windows is using for line endings but Linux isn't.

 

This is already on my fix list, but to get the scripts working on Linux you would need to convert them to Linux line endings.

 

I don't know how that could be done on Linux (anyone an idea?). Try to open the script in a Linux text editor and save it again. Or if you transferreed the files via FTP, use ASCII mode to transfer the .js files.

 

djk

 

Edit: Or ask @alwaysnoone - on page 6 he mentioned that he corrected the line endings.

Share this post


Link to post
Share on other sites
I try call commands with ^M but not work., also try load scrupt in nano linux editor and don't see any problem with newline, something else is wrong but I don't know what.

 

It's not something else; from the "^M" it's pretty clear that this is a newline ending problem. That nano editor most likely can interpret both types of line endings. I can't tell you how, but you need to convert the text file into linux line endings.

 

djk

Share this post


Link to post
Share on other sites

Notepad++ can do it. Just open the file with notepad++ and click edit then EOL Conversion and select unix (LF) then just save it

Share this post


Link to post
Share on other sites

I'm on Debian GNU/Linux, don't have Notepad++ :upset:

Notepad++ can do it. Just open the file with notepad++ and click edit then EOL Conversion and select unix (LF) then just save it

Share this post


Link to post
Share on other sites

hats off to your work.

i have no idea what it does

but i know i have adopted it on all my SMS marked servers.

 

it works like a good old granny running through the house flying on her broom cleaning up everything.

the servers just run better.

 

Thank You.

Share this post


Link to post
Share on other sites
I'm on Debian GNU/Linux, don't have Notepad++ :upset:

 

Sorry just seen this post.

 

You might try giving Notepadqq a try then. It's supposed to be a Notepad++ like editor for the Linux desktop.

Share this post


Link to post
Share on other sites

Why doesn't TFP just add this?

It's not a perfect fix. If a player just opens a corpse and then closes it (unsure whether to loot, or he wants to leave it for a friend) then the loot is still emptied when the corpse turns into a gore block. While I would always prefer an imperfect fix over a duple exploit, I can see why TFP is hesitent to patch it like this. Doing it right would take much more effort, because the client-server communication would need to be changed, possibly putting more load on the server.

 

djk

 

Seems to me that it would all be solved if the corpse body was destroyed upon closing the container, just like supply crates. That coupled with your fix, doesn't matter if they can't make up their mind, the stuff is on the ground grab it or don't, it will despawn soon.

 

[edit] in fact, why does the gore version of the corpse even need to store loot? Seems like not a very important feature to have.

Share this post


Link to post
Share on other sites
Why doesn't TFP just add this?

It's not a perfect fix. If a player just opens a corpse and then closes it (unsure whether to loot, or he wants to leave it for a friend) then the loot is still emptied when the corpse turns into a gore block. While I would always prefer an imperfect fix over a duple exploit, I can see why TFP is hesitent to patch it like this. Doing it right would take much more effort, because the client-server communication would need to be changed, possibly putting more load on the server.

 

What is it that prevents you from opening a chest when another player is accessing it if IsUserAccessing doesn't work? Could whatever does that be used instead?

Share this post


Link to post
Share on other sites

To fix non-working scrits on linux

 

* Open script in nano

nano serverfiles/Mods/ScriptingMod/scripts/js-test.js

* Use save "CTRL-O"

You can see wrong format in bottom line:

File Name to Write [DOS Format]: serverfiles/Mods/ScriptingMod/scripts/js-test.js

* Press ALT-D

line is changed to

File Name to Write: serverfiles/Mods/ScriptingMod/scripts/js-test.js

no MSDOS here ! Yay!

* press enter, then "CTRL-X" to exit.

 

Check the log file:

2017-12-10T18:30:19 3713.557 INF [sCRIPTING MOD] Changes in scripts folder detected. Reloading commands ...

2017-12-10T18:30:19 3714.058 INF [sCRIPTING MOD] Unloaded all scripting commands.

2017-12-10T18:30:19 3714.060 INF [sCRIPTING MOD] Script file inspect.lua is ignored because it does not contain a command name definition.

" in script js-minibike.js.1 INF [sCRIPTING MOD] Registered command "js-minibike

" in script js-sleepers.js.2 INF [sCRIPTING MOD] Registered command "js-sleepers

2017-12-10T18:30:19 3714.064 INF [sCRIPTING MOD] Registered command "js-test" in script js-test.js.

" in script js-variables.js. INF [sCRIPTING MOD] Registered command "js-variables

" in script lua-test.lua.159 INF [sCRIPTING MOD] Registered command "lua-test

 

There is no carriage return after "js-test". And its working now

Repeat for all needed scripts in the folder.

 

Robots wins !

Share this post


Link to post
Share on other sites
Seems to me that it would all be solved if the corpse body was destroyed upon closing the container, just like supply crates. That coupled with your fix, doesn't matter if they can't make up their mind, the stuff is on the ground grab it or don't, it will despawn soon.

 

That's actually one of the very simple solutions to the problem, which everyone can just do with XML setting destroy_on_close="true", but a) it puts your server in modded, and b) people would complain a lot about lost loot. Items do *not* drop on the groun on close, they just disappear. Same with supply crates. Happened to me countless times when I clicked on "read" in a book in the crate. :( It closed the container, read the book, and everything else was gone. Also you couldn't just look in a body and leave the content for your friend.

 

[edit] in fact, why does the gore version of the corpse even need to store loot? Seems like not a very important feature to have.

 

The dev's wanted to get rid of the zombie body as quick as possible because it occupies lots of computation power (physics, collision, position updates, ticks, ...). Gore blocks on the other hand are blocks and just occupy a few bytes of memory and almost no cpu. On horde night, the server couldn't handle all the bodies or they would block spawn of new zombies. They are still count as entities and count towards the max entity setting.

 

But you are right, gore blocks wouldn't NEED to have loot other than the harvesting material of itself (like with animals). It was just a design decision to not despawn loot quickly. People would complain if they fight horde all night and by the end 80% of the loot is already despawned.

 

What is it that prevents you from opening a chest when another player is accessing it if IsUserAccessing doesn't work? Could whatever does that be used instead?

 

Good observation! I investigated into this question many hours already:

 

When a client opens a container it actually announces a lock on it to all other clients (GameManager.TELockServer). All other clients then obey this lock until they receive the unlock signal (GameManager.TEUnlockServer). The server itself never stores this status, just distributes the log signals (NetPackageTELock.ProcessPackage).

 

TELockServer can also be called for Entity objects (see EntityCar.OnEntityActivated) but it absolutely requires an associated TileEntity at the entity's position to apply the lock to. It exists for fixed-position entities like cars or traders, but not for moveable entities like zombies or zombie-bodies (they cann roll down a hill).

 

In summary

 

  • It is only implemented for TileEntities not for objects derived from EntityAlive.
  • The server can't use this mechanism itself for decisions because it has no clue who currently has a lock. (*)

 

Therefore it requires quite a few changes both client- and server-side to make it work for zombie bodies, although it shouldn't be impossible.

 

.ooOO( djkrose )OOoo.

 

(*) This makes me think of a possible new dupe exploit:

1) Player A is logged of.

2) Player B opens a chest with good items.

3) Player A logs in and opens the chest (possible?).

4) Both players loot the same items.

Can someone try this out?

Edited by djkrose (see edit history)

Share this post


Link to post
Share on other sites

 

(*) This makes me think of a possible new dupe exploit:

1) Player A is logged of.

2) Player B opens a chest with good items.

3) Player A logs in and opens the chest (possible?).

4) Both players loot the same items.

Can someone try this out?

 

does not work

Share this post


Link to post
Share on other sites

Hi djKrose. It is possible to make a script equal to the dj-regen but to regenerate in "all the map" only the "cars" ???

It is very tiring to do it manually :D

Share this post


Link to post
Share on other sites
Hi djKrose. It is possible to make a script equal to the dj-regen but to regenerate in "all the map" only the "cars" ???

It is very tiring to do it manually :D

 

Interesting idea; i have the same problem on my server.

Cars are generated as part of the game's last decoration step together with large prefabs, vegetation, etc., so I'll have to see if I can cut that part out and just generate cars.

 

Two poblems I see already:

* What if the terrain was digged deeper? Is the car being spawned flying in the air?

* What if someone built a base where the car was? Is the generated car destroying his base?

 

Even if that is solved, an admin still needed to go around from time to time and regenerate cars; a pretty tedious task. I'd like to find a more automated solution with a generic server-wide car respawn, similar to how loot in chests respawns.

 

That is part of my bigger goal (at least for me) to create a self-maintaining server that can run for years without degredation, constantly renewing itself where necessary, without ever needing a reset. Similar to an MMORPG like WoW.

 

djkrose

Share this post


Link to post
Share on other sites

Pull the coords from the hcd's, and respawn the cars at that location, right after checking to see if the block below is a terrain block, in which case don't.

 

...optimal? Nope. =)

Share this post


Link to post
Share on other sites

Even if that is solved, an admin still needed to go around from time to time and regenerate cars; a pretty tedious task. I'd like to find a more automated solution with a generic server-wide car respawn, similar to how loot in chests respawns.

 

That is part of my bigger goal (at least for me) to create a self-maintaining server that can run for years without degredation, constantly renewing itself where necessary, without ever needing a reset. Similar to an MMORPG like WoW.

 

djkrose

 

i seem to remember seeing something like this on a xml mod around here somewhere... i think they had the cars break down into some small block that if left alone would upgrade like a plant into one of the 3 car stages after a while. something to look into.

 

Anabella did it first here, and then Royal Deluxe updated it to 16.4 for his mod here

Edited by Dracos99 (see edit history)

Share this post


Link to post
Share on other sites

I got a Christmas gift for you...

 

[TABLE]

[TR]

[TD]mcmahon18as40.jpg[/TD]

[TD]

 

 

djkrose's ScriptingMod got a new release![/TD]

[/TR]

[TR]

[TD]mcmahon27ts2k.jpg[/TD]

[TD]

 

 

Version 1.0 - First stable release![/TD]

[/TR]

[TR]

[TD]mcmahon3kvspc.jpg[/TD]

[TD]

 

 

With new event system![/TD]

[/TR]

[TR]

[TD]mcmahon4njsp3.jpg[/TD]

[TD]

 

 

Now all open source![/TD]

[/TR]

[/TABLE]

 

Download & Changelog

 

Event Documentation

 

 

.oO( djkrose)Oo.

 

 

ps: I will post a few examples and inspirations about what can be done with it in the following days.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...