Level Editing: Scripting

Talk about Severance Blade of Darkness modifications and maps here. No tips or tech support questions please, use the forum above. Note that the game is rated 18 so some content may be unsuitable for younger readers.

Moderators: prospero, Ade

Sir Random
Dragon
Posts: 737
Joined: Thu Nov 15, 2001 12:58 am
Location: Ireland
Contact:

Post by Sir Random »

I don't think so.

User avatar
Tomash
Dragon
Posts: 247
Joined: Sat Oct 25, 2008 11:23 am
Location: Russia
Contact:

Post by Tomash »

[:(]

Sir Random
Dragon
Posts: 737
Joined: Thu Nov 15, 2001 12:58 am
Location: Ireland
Contact:

Post by Sir Random »

<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by Tomash</i>

[:(]
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
What's the problem with using the AnmEndedFunc?

User avatar
Tomash
Dragon
Posts: 247
Joined: Sat Oct 25, 2008 11:23 am
Location: Russia
Contact:

Post by Tomash »

I thought this is not rational method but then I realised that engine uses more clumsy methods. So AnmEndedFunc is pretty good

User avatar
cieply
Dragon
Posts: 335
Joined: Wed Jun 26, 2013 3:43 pm

python compiled files

Post by cieply »

general python question so I think it's a good place to ask

##
what can I do to force python compilation to .pyc in Blade?
outside of console of course
to speed up map loading

documentation says there is compileFile() function but putting compileFile("defFuncs.py") in cfg.py causes error:
-- console:
Traceback (innermost last):
File "Cfg.py", line 13, in ?
compileFile ("DefFuncs.py")
NameError: compileFile
--
and it's just compilation


i got to the point where

Code: Select all

import os
import compileall
compileall.compile_dir("e:/gry/Blade of darkness/Maps/Palace_M15")
compiles all files, but they are not loaded by python
execfile("file.py") in cfg.py still uses .py not .pyc

-- cfg.py:
#execfile("DefFuncs.py")
^
--
-- console:
Traceback (innermost last):
File "Cfg.py", line 14, in ?
execfile ("DefFuncs.py")
IOError: (2, 'No such file or directory')
--

how can I load it (execfile is for soutrce files), and even force an automatic compilation if source changed and load .pyc file

I know for sure the game does it with .py/.pyc files in Lib/ and Scripts/ directories but what with maps? (or mods for that matter)
l'aria fresca,
vino puro, ...

User avatar
prospero
Ancient Dragon
Posts: 1735
Joined: Wed Nov 21, 2001 1:42 am
Location: United Kingdom

Re: Level Editing: Scripting

Post by prospero »

The game will automatically compile a .pyc file version of a .py file the first time it is imported by another .py module.

So if you make a .py file with whatever content and import it into another, a .pyc file will be created in the map folder. I think it also updates old compiled files by checking the datestamp.

User avatar
cieply
Dragon
Posts: 335
Joined: Wed Jun 26, 2013 3:43 pm

Re: Level Editing: Scripting

Post by cieply »

> The game will automatically compile a .pyc file version of a .py file the first time it is imported by another .py module.
> I think it also updates old compiled files by checking the datestamp.
it's all true in Lib/ and Scripts/ directories, not in Maps/

> So if you make a .py file with whatever content and import it into another, a .pyc file will be created in the map folder.
it won't - check yourself, there are no .pyc files in $map_dir, (except some very exceptions) and I checked file via monitor, they are not created during loading

I digged inet and it's all because in cfg.py these files are directly executed by execfile("file.py") - which means they are compiled on the fly not into bytecode and then executed - not by import, but importing them as modules would change them into modules and change all of map I guess, will try and see what can I do

anyways, digging python documentation didn't get me closer to solution either (so far, hopefuly)
l'aria fresca,
vino puro, ...

User avatar
cieply
Dragon
Posts: 335
Joined: Wed Jun 26, 2013 3:43 pm

.pyc files

Post by cieply »

you're right
python compiled bytecode will be created if the file is imported (``import module1'') and all this module contains is local object of class "module1" and can be called only this way: ``module1.function1()''
(in C it would be:
class module1
and function1() was a method of module1

when it's executed (``execfile module1.py'') it's compiled on the fly and is global
function1() is not part of module1 (in C it would be #include , code placed in place of #include)

really don't know how to solve or workaround it
l'aria fresca,
vino puro, ...

krehmall
Dragon
Posts: 176
Joined: Wed Apr 11, 2007 11:01 pm
Location: Israel
Contact:

Re: Level Editing: Scripting

Post by krehmall »

i need help , When i use EBrowser and pressing "Generate scripts" he exits the game and EBrowser.i have windows 7 home premium and console during this says nothing.

User avatar
cieply
Dragon
Posts: 335
Joined: Wed Jun 26, 2013 3:43 pm

Re: EBrowser crash

Post by cieply »

try to use prospero's ConsoleOutput.py ( http://www.petrbnsfineart.com/bladestuf ... utfile.zip )
will help you to debug even when game crashes and you cannot see console any more
l'aria fresca,
vino puro, ...

krehmall
Dragon
Posts: 176
Joined: Wed Apr 11, 2007 11:01 pm
Location: Israel
Contact:

Re: Level Editing: Scripting

Post by krehmall »

how do i use this console?i supoust to exefile in cfg.py?

User avatar
prospero
Ancient Dragon
Posts: 1735
Joined: Wed Nov 21, 2001 1:42 am
Location: United Kingdom

Re: Level Editing: Scripting

Post by prospero »

You just replace the existing ConsoleOutput.py. Then every time you play, all the debug outputs are written to a Debug.txt file in the relevant map folder.

In this case it probably wouldn't help. The fault is maybe not in the game scripts as the EB is a separate program.

User avatar
cieply
Dragon
Posts: 335
Joined: Wed Jun 26, 2013 3:43 pm

how to see map sector

Post by cieply »

is there any way to see a sector?
or maybe to fill it with atmosphere?
problem is there is no map source (.mp) for this map ($BOD/Maps/Mine_05/mine.bw)

all I found is that it is probably sector nr 2398

I found in $BOD/Maps/Mine_05/tablilla.py

Code: Select all

tSceneBSector=Bladex.GetSector(115000,-21000,-164000)
tSceneBSector.OnEnter=tSceneBStart
and found that despite of lack of information from python console in game that told me

Code: Select all

tSceneBSector
<B_PySector object at 56305e0>
I can try to dump it to file using code from def SavePickledObjects(file,aux_dir): @ $BOD/Lib/GameState.py

Code: Select all

all necessary imports like os, pickle

filename1="wy.pickle"
funcfile1=open(filename1,"wt")
p=cPickle.Pickler(funcfile1)
p.dump(tSceneBSector)
funcfile.close()
and it worked, giving me a picled sector:

Code: Select all

cPickInit
ConstSector
p1
(I2398
tRp2
.
so I guess that it is sector 2398 because (Ixxxx stands for integer

and now actual question:
how can I see it?
l'aria fresca,
vino puro, ...

krehmall
Dragon
Posts: 176
Joined: Wed Apr 11, 2007 11:01 pm
Location: Israel
Contact:

Re: Level Editing: Scripting

Post by krehmall »

Code: Select all

Executed sys_init.py
Executed PickInit.Init()
Done Trails.Init()
Creating tables for the bipeds...
tables created (0.167999982834 seconds)
Loading the knight animation sets...
asignando funciones a eventos para FX...
CombosFX.KgtCombosFX(me.Name)
Sonidos para el caballero creados...
Found 2DMap
invcontrol Shields
invcontrol Weapons
invcontrol Objects
Setting language EnglishUS
Initialising scorer data
BladeInit -> Executed DefControl.py
Menu.py -> No GameCfg.py found
Config file exed
Activadas!
Adding WAV for dinamic music for 3kngt , pre_open flag is 1
Adding WAV for dinamic music for 5bkngt , pre_open flag is 1
Adding WAV for dinamic music for 4kngt , pre_open flag is 1
Adding WAV for dinamic music for 5kngt , pre_open flag is 1
Adding WAV for dinamic music for tres1kngt , pre_open flag is 0
Adding WAV for dinamic music for Eric , pre_open flag is 1
Adding WAV for dinamic music for Terry , pre_open flag is 1
Adding WAV for dinamic music for 22kngt , pre_open flag is 1
Adding WAV for dinamic music for 23kngt , pre_open flag is 1
Adding WAV for dinamic music for Guarda1 , pre_open flag is 1
Adding WAV for dinamic music for Guarda2 , pre_open flag is 1
Adding WAV for dinamic music for Ragnar , pre_open flag is 0
Adding WAV for dinamic music for ChaosK1 , pre_open flag is 0
loading deaths...
Sonidos para el caballero traidor creados...
Loading the Cos animation sets...
Sonidos para la cosita creados...
ragnar.sf
Loading the ChaosKnight animation sets...
Sonidos para el caballero del Kaos creados...
El Objeto EscudonChaosK1 no es rompible
musica.sf
Loading Ragnar's animation sets...
Sonidos para Ragnar creados...
Loading the Prisioner animation sets...
Loading the Prisioner animation sets...
Loading the Prisioner animation sets...
Loading the Prisioner animation sets...
SkipScript Ended
Removed 'Abort'
thats what it writes its original ragnar map.(((((

User avatar
prospero
Ancient Dragon
Posts: 1735
Joined: Wed Nov 21, 2001 1:42 am
Location: United Kingdom

Re: how to see map sector

Post by prospero »

cieply wrote:is there any way to see a sector?
or maybe to fill it with atmosphere?
I do have a version of the Mines map .mp file. But the end is different to the release version. You come out the rolling balls tunnels and there is just a wall ahead. :(

No way the alter the atmos on an individual sector any other way I'm afraid. Unless you can read hex code.

:( I have all the other .mps which are all complete. If anybody ever wants one.

Post Reply