Jump to content
The Dark Mod Forums

Run console command automatically when files change


stgatilov

Recommended Posts

This is cool, also for tweaking 3D models.

 

I never learned how to do this kind of thing in python though. Interacting with other programs and that sort of thing. I wonder what that script looks like.

EDIT: maybe I should look into the automation thing in the wiki, I suppose. Will do that. Hmm, it's not obvious what I should look for... I suppose this isn't a 2.06 thing, as you mention "the most recent TDM".

Edited by Skaruts

My FMs: By The Cookbook

Link to comment
Share on other sites

It's a cool idea, although you can have similar fast workflow by binding commands like reloadimages, reloadmodels , reloaddecls to keys. Not s ure if this all can be automated, as some changes in materials for example require reloaddecls first and reloadmodels second.

Edited by Judith
  • Like 1
Link to comment
Share on other sites

On a related note, if image_downSizeLimit and image_downSize cvars could reloadImages automatically when set

then we'd have one less quality option that requires a restart.

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

This is cool, also for tweaking 3D models.

 

I never learned how to do this kind of thing in python though. Interacting with other programs and that sort of thing. I wonder what that script looks like.

EDIT: maybe I should look into the automation thing in the wiki, I suppose. Will do that. Hmm, it's not obvious what I should look for... I suppose this isn't a 2.06 thing, as you mention "the most recent TDM".

I meant the latest experimental/unofficial beta-or-not-beta build, supposedly available on moddb. They won't work with TDM 2.06

The scripts can be downloaded from here, they are supposed to be run from some subdirectory of TDM installation directory.

 

It's a cool idea, although you can have similar fast workflow by binding commands like reloadimages, reloadmodels , reloaddecls to keys. Not s ure if this all can be automated, as some changes in materials for example require reloaddecls first and reloadmodels second.

Could you please be more specific? Do you mean that changing only image file is sometimes enough, but reloadDecls is required in addition to reloadImages?

 

Note that I have almost zero idea about how this all works.

Unless someone helps me with particular rules, all of this won't work.

  • Like 1
Link to comment
Share on other sites

Hmm...

 

With testing Materials, I think you can point to a new texture filename and just use ReloadDecls.

You'd only need to ReloadImages if you update the texture image but keep the same filename.

 

I can't speak to models, etc.

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

For example, when you're changing material to include noshadows or noselfshadows, you need to reloaddecls first, but you won't see the effect on your model until you reloadmodels.

reloadDecls + reloadModels after changing anything like *.mtr.

reloadImages after changing something like *.tga, *.dds, *.jpg.

More examples?...

 

Do I understand right that reloadXXX commands only actually reload files which have changed (I saw that "last modified time" is checked somewhere), so they work pretty fast?

Link to comment
Share on other sites

Do I understand right that reloadXXX commands only actually reload files which have changed (I saw that "last modified time" is checked somewhere), so they work pretty fast?

 

Yeah, they don't reload the whole map. If you have this bound to a key, you just press it and the latest texture, material, or version of a model pops into place.

Edited by Judith
Link to comment
Share on other sites

Its a nice start of a new feature for TDM.

Can I use this for debugging problems in TDM on the system of the user?

The TDM game and the script are connected via ordinary TCP connection.

So in theory yes, you can ask user to enable automation in his TDM, and then configure the script to connect to remote machine.

If you can reach the player's machine by IP, then it should work.

 

My machine is not reachable directly from internet.

If you are interested to test it out, I can write a simple script.

It would connect to specified IP and allow you (me) to run TDM console commands with getting back whatever TDM writes to console.

 

Note that the system was never designed with network latencies in mind.

It should not matter much for running console commands.

Link to comment
Share on other sites

I want to create a script, that the user runs on their system and speaks to it and to TDM.

Is this feature for the published 2.06 or higher?

Is there any documentation about this automation feature? Cant find anything on the wiki.

 

 

And is there a mini portable package of python?

Like one single binary executable, that runs a python script?

Edited by freyk

Info: My portfolio and darkmod graphical installer
Amnesty for Bikerdude!

Link to comment
Share on other sites

I tried to change some texture while being in-game, but all my changes have no effect.

First I tried to change a guard at the main entrance to the tavern in Inn Business, and changed all jpg textures in /models/md5/char/guards/proguard.

Then I tried to change the carpet in the tavern (near two guards playing cards), and changed \textures\darkmod\carpet\runners\geometric01_red_ed.jpg.

Every time I did reloadImages, reloadModels and reloadDecls in all combinations, but nothing changes.

 

Could someone please write complete steps how to change a texture without reloading engine?

I mean something like:

1) Load "..." FM and go to "..." well-known place and look at "..." object.

2) Find jpg file at "..." and modify it.

3) Run "..." and "..." console commands in TDM console.

4) Notice that the object looks different now.

 

Link to comment
Share on other sites

I want to create a script, that the user runs on their system and speaks to it and to TDM.

Ok, so you don't need real network.

Is this feature for the published 2.06 or higher?

The TDM-side support was started after 2.06. So you cannot run scripts against TDM 2.06, but you will be able to run them against 2.07.

Also, the latest unofficial build from moddb most likely supports it on TDM side.

The python code itself is contained in assets SVN, I have posted a download link above.

Is there any documentation about this automation feature? Cant find anything on the wiki.

Not yet.

The amount of documentation which will appear on 2.07 release depends on how much functionality I can implement now :D

Right now it can only help you to reload GLSL, which is a purely developer's feature.

And is there a mini portable package of python?

Like one single binary executable, that runs a python script?

Probably not.

Some people say you can take ordinary CPython installation, configure paths and it should work.

Also, you can convert Python code into standalone executable, although it feels less secure for potential receivers.

Link to comment
Share on other sites

  • 2 weeks later...

In the latest SVN version (not publicly available yet), I have supported user actions in automation.

Believe it or not, but the main incentive of this major work was to be able to bypass "Press Attack to start" screen programmatically.

Now you can use automation to make player walk, rotate view, attack and do various special actions internally known as "impulses".

 

Meanwhile, I did not extend the watcher script.

As I wrote above, I need a help from experienced mappers to implement automatic reloading of anything (except GLSL which I needed for myself).

 

Link to comment
Share on other sites

Is it possible to "beam over" the player to a specified location?

So we can debug a bug in training mission.

http://forums.thedarkmod.com/topic/19721-training-mission-bug/

What does "beam over" mean?

There is a command setviewpos (and teleport), which puts player to specified coordinates.

In all the publicly available versions it can only set yaw view angle, they have no way to specify pitch angle (although it would be changed in next version).

 

What exactly do you want to do?

Link to comment
Share on other sites

Beam over > Transport.

If people say the some locations slows their system down, you can pinpoint it using those commands.

 

Using the automation feature, for benchmarking, test settings, debugging, etc.

It is possible to write a script which will query FPS every second.

When you finish playing, it will produce file with a list of locations sorted by FPS increasing (x y z + pitch yaw + timestamp).

Then you can take any of these locations and use setviewpos to teleport to it.

Note that if player knows which place poses a problem, you can ask him to write getviewpos, and then use setviewpos to move there.

Link to comment
Share on other sites

  • 9 months later...

By the way, reloading images/decls/models would be super useful for dual monitor setup. You can have the game mode launched on one monitor, and you can tweak your textures in Gimp, or change materials in .mtr file on the other - and the game mode would update shortly atfer exporting a texture or saving the mtr file. This would speed up material prototyping immensely.

Link to comment
Share on other sites

  • 3 years later...

Sorry for necroposting. And also sorry if this is total nonsense..

 

On 10/22/2018 at 3:30 PM, stgatilov said:
setviewpos {saved coords}  // teleport to the same exact location

The envshot command is still used for creating ambientCubicLights?

I wondered If it's possible, via automation, to load a map, jump to the center of every room in the map and do the envshot command there and then exit. (then automatically create some mtr files..)

Link to comment
Share on other sites

6 hours ago, datiswous said:

I wondered If it's possible, via automation, to load a map, jump to the center of every room in the map and do the envshot command there and then exit. (then automatically create some mtr files..)

If you are OK with manually listing all coordinates and names, then it should work.
Creating materials... if you write some Python code.

Do you want to try?
As far as I remember, automation scripts are not published anywhere 😥

 

Link to comment
Share on other sites

4 hours ago, stgatilov said:

If you are OK with manually listing all coordinates and names, then it should work.

Is it possible to teleport to a select entity? For example a specific info_location entity, without knowing the coordinates? If that was placed in the middle of every room.

I was also thinking something like this could be done with a TDM script, but then can you still activate the envshot command?

Edited by datiswous
Link to comment
Share on other sites

8 hours ago, datiswous said:

Is it possible to teleport to a select entity? For example a specific info_location entity, without knowing the coordinates? If that was placed in the middle of every room.

There is "teleport" console command as well, just type the entity name.

Quote

I was also thinking something like this could be done with a TDM script, but then can you still activate the envshot command?

I don't think it is possible to execute arbitrary console commands from game scripts.
Even changing cvars is a bad idea, in fact.

Link to comment
Share on other sites

I'm fiddling with the automation feature and it's fun.

Btw. I think some of the mainmenu guiscripts won't work anymore because of the changed main menu gui (I assume).

@gamectrl down doesn't seem to do anything in the game (while the console says Finished) and I have noclip enabled. @gamectrl up works fine.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • Petike the Taffer  »  DeTeEff

      I've updated the articles for your FMs and your author category at the wiki. Your newer nickname (DeTeEff) now comes first, and the one in parentheses is your older nickname (Fieldmedic). Just to avoid confusing people who played your FMs years ago and remember your older nickname. I've added a wiki article for your latest FM, Who Watches the Watcher?, as part of my current updating efforts. Unless I overlooked something, you have five different FMs so far.
      · 0 replies
    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
    • OrbWeaver

      I like the new frob highlight but it would nice if it was less "flickery" while moving over objects (especially barred metal doors).
      · 4 replies
×
×
  • Create New...