Nexus: The Jupiter Incident

Nexus: The Jupiter Incident

Universe Script Library
 此主题已被置顶,因此可能具有重要性
TehnoMag  [开发者] 2017 年 9 月 21 日 上午 11:11
Module/Class syntax Speculation
New, more friendly syntax is coming. I want to discuss him before publish.
And any ideas, how to secure private variables are welcome, cos now they are avalible via
U.uSL.Test:self:variable command

NAME "uSL.Module.Test" CONST //Place module constatns here END RULE event uSL.ModuleInit condition uSL.Module.Test&!isValid(uSL.Module.Test) :action //Module initialization procedure uSL.Module.Test:= getMachine("uSL/module/Test"); uSL.Module.Test:changeState(Init, 0); :end END RULE event uSL.ModulePostInit condition isValid(uSL.Module.Test) :action //Post access //for example gain access from universe U.uSL.Test := uSL.Module.Test:public; :end END //Module Body MACHINE "uSL/module/Test" #include "uSL/module/init" RULE event onInit :action //This event hits after main initialization. You can do additional staff here Debug("=== uSL Module 'Test' Initialized ==="); :end END #include "uSL/module/begin" #include "uSL/function/public" //Functions in this scope will be avalible via U.uSL.Test:localEvent command RULE event PublicFunc :action //Private functions avaliable via special 'self' valiable self:localEvent(PrivateFunc,0); :end END #include "uSL/function/end" #include "uSL/function/private" //Functions in this scope will be avalible only from public scope or root subroutine RULE event PrivateFunc :action //if need public function calling, use 'self' variable Debug(C.this); :end END #include "uSL/function/end" #include "uSL/module/end" END END
最后由 TehnoMag 编辑于; 2017 年 9 月 28 日 上午 9:04
< >
正在显示第 1 - 9 条,共 9 条留言
TehnoMag  [开发者] 2017 年 9 月 22 日 上午 3:11 
Well. I secured private scope via 'self' variable transfer from semiglobal to Event scope. For now functions from different scopes must be called like this:

E.self:localEvent(functionname, arguments);

By another words: all content after 'uSL/function/private' declaration are unavailable from any places but available from public scope.
最后由 TehnoMag 编辑于; 2017 年 9 月 22 日 上午 3:16
TehnoMag  [开发者] 2017 年 9 月 24 日 上午 4:48 
I thought a lot about private variables. And decided to abandon them. The engine does not allow them to be done normally, and i do not really want to do crutches. As a result, I changed the syntax for the modules as follows :

CONST uSL_TEST_CONST 256 END RULE event uSL.Test.StaticFunction #include "uSL/function/private" :action debug(C.this); :end END MACHINE "uSL/Module/Test" #include "uSL/module/initialize" RULE event onInitialize :action //gain access from story scope U.uSL.Test := this; Debug("=== uSL Module `Test` initialized ==="); :end END #include "uSL/module/body" RULE event Test :action this:localEvent(pvTest,0); :end END RULE event pvTest #include "uSL/function/private" :action Debug("pvTest"); :end END #include "uSL/module/end" END

As you see NAME block are also missing. It is because 'usubroutines' has issue with routines naming (all routines has name equivalent last loaded 'usubroutine').

Also i added configuration event, which must be present in standalone mod or opt mods, which extend library functionality. It must be placed in Universe/Strategy/Subroutines folded with name 'mod.modname.ini' (for compatibility with other mods). And contain this code:

RULE event uSL.Configuration :action localEvent(uSL.UseModule, E.module := "Class"); localEvent(uSL.UseModule, E.module := "Universe"); :end END

Here we load 2 modules. Module "Class" for OOP support
and module "Universe".

if module are not present in configuration, machine (if present) has not state; and no access from Story or Mission scope to it.

I publish update after finish debugging.
最后由 TehnoMag 编辑于; 2017 年 9 月 24 日 上午 7:21
TehnoMag  [开发者] 2017 年 9 月 24 日 上午 10:32 
Update was published.

WARNING!You need resubscribe the mod for proper update
最后由 TehnoMag 编辑于; 2017 年 9 月 24 日 上午 11:01
Rincewind 2017 年 11 月 24 日 下午 11:04 
Вопрос не совсем по теме наверно.Но что вообще позволенно моддеру? Изменять сюжетную компанию? Ну, например, самое простое - спавнить 2х больше противников чем в оригинале. И тп
Или весь моддинг тут касается лишь каких-то кустомных карт?
TehnoMag  [开发者] 2017 年 11 月 25 日 上午 2:49 
В задумке дать возможность модеру заменить компанию на компанию в открытом мире. Над модом думал давно, еще с 05 года, но, как видете прихожу наплывами, по настроению.

В результате разбил большой мод на несколько библиотек.
1) Это отключение сюжетной компании
2) Библиотека скриптов и хелперов (этот мод)
3) Собственно открытый мир
4) Сюжет.
最后由 TehnoMag 编辑于; 2017 年 11 月 25 日 上午 2:50
Rincewind 2017 年 11 月 25 日 上午 2:56 
А саму компанию можно как-то изменять?
TehnoMag  [开发者] 2017 年 11 月 25 日 上午 2:57 
Компанию можно изменять и без модов. Скрипты открыты, и документация есть в комплекте с игрой.
Если будут вопросы, можешь создать отдельную тему в общем обсуждении, с удовольствием помогу.
最后由 TehnoMag 编辑于; 2017 年 11 月 25 日 上午 3:00
TehnoMag  [开发者] 2018 年 1 月 5 日 下午 12:46 
In build 13 i will present new conception of Class module.

Major difference betwin current realisation it`s a mapper betwin standart uType objects (objects that have valid uType() method) and uSL object. Every object in game in this realisation have a shadow object in uSL with addition parameters and methods.

This is new realisation are not complete yet and avaliable only on GitHubs feature brunch for now (link to it i added to description right now)
最后由 TehnoMag 编辑于; 2018 年 1 月 5 日 下午 12:46
TehnoMag  [开发者] 2018 年 1 月 7 日 上午 6:09 
I just pushed Universe children utypes into feature brunch. It seems that in game we have more of 400 diffrent entityes. Most of them are not used at all. In table you can find all types (more or less) that used in game. In future this list can be expanded.
最后由 TehnoMag 编辑于; 2018 年 1 月 7 日 上午 6:10
< >
正在显示第 1 - 9 条,共 9 条留言
每页显示数: 1530 50