Useful book (customizable scripts and more)


Store and use any script in Lua/Candran/Teal/MoonScript or create custom commands/events. Admins can share access to an executable code to players and to rcon. It's more practical than "Lua Compiler" mod. This mod is designed to be safe, simple and fast. Anyone can translate the mod on Crowdin. https://crowdin.com/project/factorio-mods-localization

Utilities
15 days ago
1.1
466
Cheats

i Ability to pre-set scripts for the game

2 years ago
(updated 2 years ago)

Please add an ability to pre-set public/admin scripts for the game:

1) via export/import encoded string - import multiple (add, not replace) / export all scripts

2) add to the Startup settings tab a new text field with the encoded string of scripts - load it on a NEW game start only.
3) add button to clear all scripts and replace them with default (current 4 admin scripts)

2 years ago

main idea - to make it easy to pre-install commonly used scripts by some local gamers for all new games for LAN/Internet network

2 years ago
(updated 2 years ago)

1) Hm, it's possible... (should the mod check similarity of scripts? hm... I'll probably compress the text)
2) Welp, it seems easy, if the 1st section will be completed.
3) ~easy

At such rate, interface should be improved in order to more easily manage scripts...

2 years ago
(updated 2 years ago)

1) just add a copy of scripts on import - all from the bundle string. Users can remove them 1-by-1 and re-export all them again as a string if needed.

2) I really like this idea. I first saw this in a mod that sets the initial configuration (per a player) on the player's belt cells (at bottom center). Very helpful if you do not want to play with import-export of strings in an every new game.

2 years ago
(updated 2 years ago)

Hm, perhaps, I'll create a test version since it can be implemented differently. I should avoid loadstring etc because of security issues.

2 years ago

Π° Π² Ρ‡Π΅ΠΌ Ρ‚Π°ΠΌ ΠΏΡ€ΠΎΠ±Π»Π΅ΠΌΠ° с Π±Π΅Π·ΠΎΠΏΠ°ΡΠ½ΠΎΡΡ‚ΡŒΡŽ?

2 years ago
(updated 2 years ago)

loadstring ΠΈ ΠΏΠΎΠ΄ΠΎΠ±Π½Ρ‹Π΅ Ρ„ΡƒΠ½ΠΊΡ†ΠΈΠΈ Π² lua выполняСт тСкст ΠΊΠ°ΠΊ ΠΊΠΎΠ΄. ΠŸΡ€Π°ΠΊΡ‚ΠΈΡ‡Π΅ΡΠΊΠΈ ΠΏΠΎΠ»Π½Ρ‹ΠΉ/любой доступ ΠΊ ΠΈΠ³Ρ€Π΅ ΠΌΠΎΠΆΠ΅Ρ‚ ΠΏΠΎΠ»ΡƒΡ‡ΠΈΡ‚ΡŒ ΠΈΠ³Ρ€ΠΎΠΊ, Ссли смоТСт ΠΏΠΎΠ΄ΡΡƒΠ½ΡƒΡ‚ΡŒ ΠΊΠΎΠ΄ Π°Π΄ΠΌΠΈΠ½Π°ΠΌ/ΠΌΠΎΠ΄Ρƒ ΠΈ ΠΎΠ½ΠΈ, скорСС всСго, Π½Π΅ замСтят этого.

2 years ago
(updated 2 years ago)

я скорСС Π΄ΡƒΠΌΠ°Π»Π° Ρ‡Ρ‚ΠΎ Ρ‚Ρ‹ ΠΏΡ€ΠΈΠΌΠ΅Π½ΠΈΡˆΡŒ encode_string (https://lua-api.factorio.com/latest/LuaGameScript.html)
Ρ‡Ρ‚ΠΎΡ‚ΠΎ Ρ‚ΠΈΠΏΠ° ΠΊΠΎΠ½Π²Π΅Ρ€Ρ‚Π½ΡƒΡ‚ΡŒ всС скрипты Π² json { name: 'xxx', description: 'xxx', public: true, content:'xxx'}, ΠΏΠΎΡ‚ΠΎΠΌ Π² Π΅Π΄ΠΈΠ½ΡƒΡŽ строку Ρ‡Π΅Ρ€Π΅Π· Ρ„ΡƒΠ½ΠΊΡ†ΠΈΡŽ
ΠΈ ΠΎΠ±Ρ€Π°Ρ‚Π½ΠΎ Ρ‡Ρ‚Π΅Π½ΠΈΠ΅ Ρ‚Π°ΠΊΠΎΠ΅ ΠΆΠ΅.

я ΠΈ Π½Π΅ Π΄ΡƒΠΌΠ°Π»Π°, Ρ‡Ρ‚ΠΎ Ρ‚Ρ‹ сразу Ρ…ΠΎΡ‡Π΅ΡˆΡŒ Π²Ρ‹ΠΏΠΎΠ»Π½ΠΈΡ‚ΡŒ скрипт (autostart?). ΠŸΡƒΡΡ‚ΡŒ Π°Π΄ΠΌΠΈΠ½ Π·Π°Π³Ρ€ΡƒΠ·ΠΈΡ‚ строку ΠΈΠ»ΠΈ Π°Π²Ρ‚ΠΎΠ·Π°Π³Ρ€ΡƒΠ·ΠΈΡ‚ Π·Π°ΡˆΠΈΡ„Ρ€ΠΎΠ²Π°Π½Π½ΡƒΡŽ строку ΠΈΠ· startup настроСк - ΠΎΠ½, Π°Π΄ΠΌΠΈΠ½, смоТСт ΠΆΠ΅ ΠΏΡ€ΠΎΡΠΌΠΎΡ‚Ρ€Π΅Ρ‚ΡŒ скрипт, ΠΏΡ€Π΅ΠΆΠ΄Π΅ Ρ‡Π΅ΠΌ ΠΎΠ½ Π΅Π³ΠΎ запустит.

2 years ago
(updated 2 years ago)

Ах, Π½Ρƒ Ρ…ΠΎΡ‚ΡŒ Π½Π΅ Π½Π°Ρ‡Π°Π» Π΅Ρ‰Ρ‘. Factorio вСсьма Ρ…ΠΎΡ€ΠΎΡˆΠΎ справляСтся с json, вспомнил послС Ρ‚Π²ΠΎΠ΅Π³ΠΎ сообщСния.
Π£ мСня Π½Π΅Ρ‚ ΠΏΠ»Π°Π½ΠΎΠ² Π΄ΠΎΠ±Π°Π²Π»ΡΡ‚ΡŒ Π°Π²Ρ‚ΠΎ-скрипт, хотя Π² ΠΏΠ»Π°Π½Π΅ Π² Ρ€Π΅Π°Π»ΠΈΠ·Π°Ρ†ΠΈΠΈ с событиями Π½Π΅ Ρ‚Π°ΠΊ ΡƒΠΆ ΠΈ плохая идСя. (для этого Π΅ΡΡ‚ΡŒ Π΄Ρ€ΡƒΠ³ΠΎΠΉ ΠΌΠΎΠ΄)
Π˜Ρ‚Π°ΠΊ, экспорт: table->json
Π˜ΠΌΠΏΠΎΡ€Ρ‚: json->table

2 years ago
(updated 2 years ago)

Enjoy the new update. (About the 3rd section, I decided to use a command instead)

2 years ago
(updated 2 years ago)

Though, maybe, I should export json data in another player setting. However, it may lead too big pile of trash data for the game.

2 years ago

Π½ΠΈΡ„ΠΈΠ³Π° Π½Π΅ понял ΠΊΠ°ΠΊ ΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚ΡŒΡΡ:
запустил ΠΊΠΎΠΌΠ°Π½Π΄Ρƒ экспорт Π±Π΅Π· ΠΏΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€ΠΎΠ² - появился Ρ„Π°ΠΉΠ» json (Π½Π΅ Π·Π°ΡˆΠΈΡ„Ρ€ΠΎΠ²Π°Π½)
запустил ΠΊΠΎΠΌΠ°Π½Π΄Ρƒ ΠΈΠΌΠΏΠΎΡ€Ρ‚Π° Π±Π΅Π· ΠΏΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€ΠΎΠ² - ΠΏΠΈΡˆΠ΅Ρ‚ ΠΏΡ€ΠΎ ΠΈΠΌΠΏΠΎΡ€Ρ‚ всСх скриптов, Π½ΠΎ Π² окошкС Π½ΠΈΡ‡Π΅Π³ΠΎ Π½Π΅ мСнялось - Π·Π°ΠΊΡ€Ρ‹Π» ΠΎΠΊΠ½ΠΎ, Π΅Ρ‰Π΅ Ρ€Π°Π· ΠΈΠΌΠΏΠΎΡ€Ρ‚, ΠΎΡ‚ΠΊΡ€Ρ‹Π» - Π½ΠΈΡ‡Π΅Π³ΠΎ Π½Π΅ помСнялось

ΠΏΠΎΠΏΡ€ΠΎΠ±ΠΎΠ²Π°Π» ΠΈΠΌΠΏΠΎΡ€Ρ‚ ΠΊΠΎΠΌΠ°Π½Π΄Ρƒ с 123 ΠΏΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€ΠΎΠΌ - ошибка Π² консоли. Ок, Π΄ΡƒΠΌΠ°ΡŽ Π½Π°Π΄ΠΎ ΡΠΊΠΎΠΏΠΈΡ€ΠΎΠ²Π°Ρ‚ΡŒ ΠΊΠΎΠ½Ρ‚Π΅Π½Ρ‚ Ρ„Π°ΠΉΠ»Π° ΠΈ Π²ΡΡ‚Π°Π²ΠΈΡ‚ΡŒ Π² консоль послС ΠΊΠΎΠΌΠ°Π½Π΄Ρ‹
ΠΏΡ€ΠΎΠ±ΡƒΡŽ снова /Ubook-import <json_content> - ΠΏΠΈΡˆΠ΅Ρ‚ "Max. length", ΠΈ Π½ΠΈΡ‡Π΅Π³ΠΎ Π½Π΅ мСняСтся...
ΠΏΡ€ΠΎΠ±ΡƒΡŽ /Ubook-import "<json_content>" - с ΠΊΠ°Π²Ρ‹Ρ‡ΠΊΠ°ΠΌΠΈ - Ρ‚ΠΎΠΆΠ΅ самоС - max length, Π½ΠΈΡ‡Π΅Π³ΠΎ Π½Π΅ сработало

2 years ago
(updated 2 years ago)

ΠœΠΎΠΆΠ΅Ρ‚Π΅ ΡΠΊΠΈΠ½ΡƒΡ‚ΡŒ Ρ„ΠΎΡ‚ΠΎ сообщСния?

/Ubook-import {"public":{},"admin":[{"description":["scripts-description.reveal-gen-map"],"title":["scripts-titles.reveal-gen-map"],"code":"local player = ...\nplayer.force.chart_all()"},{"description":["scripts-description.kill-all-enemies"],"title":["scripts-titles.kill-all-enemies"],"code":"local player = ...\n    local entities = player.surface.find_entities_filtered({force=\"enemy\"})\n    for i=1, #entities do\n      entities[i].destroy()\n    end"}]}

Π­Ρ‚ΠΎ Π΄ΠΎΠ»ΠΆΠ½ΠΎ ΡΡ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ.
(Π₯ΠΌ, я каТСтся ΠΎΡˆΠΈΠ±ΠΊΡƒ сдСлал Π² ΠΎΠ΄Π½ΠΎΠΌ ΠΈΠ· скриптов, исправил Π² Π½ΠΎΠ²ΠΎΠΉ вСрсии)

2 years ago
(updated 2 years ago)

~

2 years ago
(updated 2 years ago)

А, Π΅ΡΡ‚ΡŒ ΠΎΠ³Ρ€Π°Π½ΠΈΡ‡Π΅Π½ΠΈΠ΅ Π½Π° тСкст Π² ΠΊΠΎΠΌΠ°Π½Π΄Π°Ρ…

2 years ago

Π§Π΅Ρ€Π΅Π· нСсколько часов ΠΏΠ΅Ρ€Π΅Π΄Π΅Π»Π°ΡŽ, ΡƒΠ»ΡƒΡ‡ΡˆΡƒ.

2 years ago
2 years ago

works. Just add commands and an export button info to the mod's brief here (the first tab). Closed

2 years ago
(updated 2 years ago)

... Π½ΠΎ я Π±Ρ‹ Π΄Π΅Π»Π°Π»Π° ΡƒΠΆΠ΅ GUI ΠΊΠ½ΠΎΠΏΠΊΠΈ Π½Π° reset/import (ΠΏΠΎΡ‚ΠΎΠΌ)

2 years ago
(updated 2 years ago)

Just add commands ...

Does it worth it to open the import interface? I'll recheck stuff

2 years ago

I added and fixed /Ubook-import command.

2 years ago

я ΠΈΠΌΠ΅Π»Π° Π² Π²ΠΈΠ΄Ρƒ, Ρ‡Ρ‚ΠΎ всС ΠΎΠΊ, Π½ΠΎ добавь описаниС Π½Π° ΠΏΠ΅Ρ€Π²ΡƒΡŽ Π·Π°ΠΊΠ»Π°Π΄ΠΊΡƒ Ρ‚ΡƒΡ‚ - Information - ΠΊΠ°ΠΊΠΈΠ΅ ΠΊΠΎΠΌΠ°Π½Π΄Ρ‹ Π΅ΡΡ‚ΡŒ для Π²Π½ΡƒΡ‚Ρ€ΠΈΠΈΠ³Ρ€ΠΎΠ²ΠΎΠΉ консоли, ΠΈ Ρ‡Ρ‚ΠΎ Π΅ΡΡ‚ΡŒ ΠΊΠ½ΠΎΠΏΠΊΠΈ ΠΈΠΌΠΏΠΎΡ€Ρ‚Π° (старыС ΡΠΊΡ€ΠΈΠ½ΡˆΠΎΡ‚Ρ‹ Π·Π°ΠΌΠ΅Π½ΠΈΡ‚ΡŒ Π½ΠΎΠ²Ρ‹ΠΌΠΈ)

2 years ago

Как Ρ‚ΠΎΠ»ΡŒΠΊΠΎ ΠΎΠΏΡ€Π΅Π΄Π΅Π»ΡŽΡΡŒ ΠΈ Π½Π΅ Π±ΡƒΠ΄Π΅Ρ‚ лСнь всС это Π΄Π΅Π»Π°Ρ‚ΡŒ.

New response