Nexus: The Jupiter Incident

Nexus: The Jupiter Incident

Universe Script Library
 This topic has been pinned, so it's probably important
TehnoMag  [developer] 21 Sep, 2017 @ 11:11am
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
Last edited by TehnoMag; 28 Sep, 2017 @ 9:04am
< >
Showing 1-9 of 9 comments
TehnoMag  [developer] 22 Sep, 2017 @ 3:11am 
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.
Last edited by TehnoMag; 22 Sep, 2017 @ 3:16am
TehnoMag  [developer] 24 Sep, 2017 @ 4:48am 
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.
Last edited by TehnoMag; 24 Sep, 2017 @ 7:21am
TehnoMag  [developer] 24 Sep, 2017 @ 10:32am 
Update was published.

WARNING!You need resubscribe the mod for proper update
Last edited by TehnoMag; 24 Sep, 2017 @ 11:01am
Rincewind 24 Nov, 2017 @ 11:04pm 
Вопрос не совсем по теме наверно.Но что вообще позволенно моддеру? Изменять сюжетную компанию? Ну, например, самое простое - спавнить 2х больше противников чем в оригинале. И тп
Или весь моддинг тут касается лишь каких-то кустомных карт?
TehnoMag  [developer] 25 Nov, 2017 @ 2:49am 
В задумке дать возможность модеру заменить компанию на компанию в открытом мире. Над модом думал давно, еще с 05 года, но, как видете прихожу наплывами, по настроению.

В результате разбил большой мод на несколько библиотек.
1) Это отключение сюжетной компании
2) Библиотека скриптов и хелперов (этот мод)
3) Собственно открытый мир
4) Сюжет.
Last edited by TehnoMag; 25 Nov, 2017 @ 2:50am
Rincewind 25 Nov, 2017 @ 2:56am 
А саму компанию можно как-то изменять?
TehnoMag  [developer] 25 Nov, 2017 @ 2:57am 
Компанию можно изменять и без модов. Скрипты открыты, и документация есть в комплекте с игрой.
Если будут вопросы, можешь создать отдельную тему в общем обсуждении, с удовольствием помогу.
Last edited by TehnoMag; 25 Nov, 2017 @ 3:00am
TehnoMag  [developer] 5 Jan, 2018 @ 12:46pm 
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)
Last edited by TehnoMag; 5 Jan, 2018 @ 12:46pm
TehnoMag  [developer] 7 Jan, 2018 @ 6:09am 
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.
Last edited by TehnoMag; 7 Jan, 2018 @ 6:10am
< >
Showing 1-9 of 9 comments
Per page: 1530 50