Jump to content
The Dark Mod Forums
demagogue

Newbie DarkRadiant Questions

Recommended Posts

Yeah weird, no geometry pop in due to broken Visportals when the draw calls skyrocket. There are other things like light counts or shaders that can increase counts, but I don't see anything obvious there.

Can you move your player start in DarkRadiant to that point and upload the map file somewhere?


I always assumed I'd taste like boot leather.

 

Share this post


Link to post
Share on other sites

I want a bound object to move with a particular master's joint, but maintain the same angular position (as world's axis). Can bind properties be partially disabled, or can I modify binding script? I can't see it in script files.


S2wtMNl.gif

Share this post


Link to post
Share on other sites

I've been doing some script coding, and it looks like there is a maximum length for string variables in scripts: 127 characters. Any strings longer than that get truncated. Is this a known limitation?

Let me explain what I'm trying to do. I want to dynamically create a readable, based on the status of the mission. Here's an example of the script code:

ai guard = $atdm_ai_guard_elite_1;
string msg;
if (guard.AI_DEAD)
{
    msg = "He's dead, Jim.";
}
else
{
    msg = "He's fine, Jim.";
}
sys.setSpawnArg("gui_page1", "guis/readables/sheets/sheet_paper_calig_mac_humaine.gui");
sys.setSpawnArg("page1_body", msg);
sys.setSpawnArg("num_pages", "1");
entity testnote = sys.spawn("atdm:readable_mobile_paper01");
$player1.addInvItem(testnote);

This works great - the player gets a note in the inventory with the appropriate content. But, if I try to make the 'msg' text longer, beyond 127 characters, it gets truncated. I was excited about being able to dynamically create readables until I ran into this issue. Does anyone have an idea how to make this work? Yes, in this simple case I could just create two xdata_contents and dynamically point at one or the other. But what I really want to do is more complicated logic, involving several variables. I would have to create 10 or 20 different xdatas to handle all of the permutations. I'd rather not do that.

Share this post


Link to post
Share on other sites
7 hours ago, joebarnin said:

I've been doing some script coding, and it looks like there is a maximum length for string variables in scripts: 127 characters. Any strings longer than that get truncated. Is this a known limitation?

Let me explain what I'm trying to do. I want to dynamically create a readable, based on the status of the mission. Here's an example of the script code:


ai guard = $atdm_ai_guard_elite_1;
string msg;
if (guard.AI_DEAD)
{
    msg = "He's dead, Jim.";
}
else
{
    msg = "He's fine, Jim.";
}
sys.setSpawnArg("gui_page1", "guis/readables/sheets/sheet_paper_calig_mac_humaine.gui");
sys.setSpawnArg("page1_body", msg);
sys.setSpawnArg("num_pages", "1");
entity testnote = sys.spawn("atdm:readable_mobile_paper01");
$player1.addInvItem(testnote);

This works great - the player gets a note in the inventory with the appropriate content. But, if I try to make the 'msg' text longer, beyond 127 characters, it gets truncated. I was excited about being able to dynamically create readables until I ran into this issue. Does anyone have an idea how to make this work? Yes, in this simple case I could just create two xdata_contents and dynamically point at one or the other. But what I really want to do is more complicated logic, involving several variables. I would have to create 10 or 20 different xdatas to handle all of the permutations. I'd rather not do that.

If this does not resolve with a simple workaround here, please start a new thread or a bugtracker entry

Share this post


Link to post
Share on other sites
2 hours ago, duzenko said:

If this does not resolve with a simple workaround here, please start a new thread or a bugtracker entry

I think it's a script system limitation

#define MAX_STRING_LEN		128

 

  • Thanks 1

Share this post


Link to post
Share on other sites
18 hours ago, duzenko said:

I think it's a script system limitation

That could maybe be worked around by having a variable per line of text.
Does the page1_body spawnarg support sub-indexing (page1_body1, page1_body2, ...)?

Edited by Abusimplea

Share this post


Link to post
Share on other sites
13 hours ago, Abusimplea said:

Does the page1_body spawnarg support sub-indexing (page1_body1, page1_body2, ...)?

Nope, I tried that, it doesn't work. I was able to implement something similar to that, by modifying the readable GUI (e.g., sheet_paper_calig_mac_humaine.gui) so that it supported _body1, _body2, etc. That enables me to put multiple strings in the body from a script, as long as each is less than 128 characters. This technique comes with significant limitations: each _body# is effectively a paragraph, and you have to manually position it using newline characters. Highly kluge-a-rific, but it may have to do for now.

I'll submit something in the bugtracker too.

Share this post


Link to post
Share on other sites
1 hour ago, joebarnin said:

Nope, I tried that, it doesn't work. I was able to implement something similar to that, by modifying the readable GUI (e.g., sheet_paper_calig_mac_humaine.gui) so that it supported _body1, _body2, etc. That enables me to put multiple strings in the body from a script, as long as each is less than 128 characters. This technique comes with significant limitations: each _body# is effectively a paragraph, and you have to manually position it using newline characters. Highly kluge-a-rific, but it may have to do for now.

I'll submit something in the bugtracker too.

While you're at it, could you also create a test map for this?

I suggest two readables - one truncating and the other makes use of xdata for reference

Share this post


Link to post
Share on other sites
11 hours ago, joebarnin said:

Thank you

Just as a side note: better to put all map content in a single .zip with folders, to save on time to reproduce

EDIT

I can only see one readable - the one created in DR. Where's the other one?

Did you forget to add the custom script that references the readabletest.script? I'm asking because I'm rather clueless about scripting

Share this post


Link to post
Share on other sites

Sorry about that. I updated the bug report with a test case - a complete mission zip with folders. The script file has the same name as the map, so the main() method within it will run automatically when you run the map.

  • Like 1

Share this post


Link to post
Share on other sites
On 5/3/2020 at 6:13 PM, joebarnin said:

Sorry about that. I updated the bug report with a test case - a complete mission zip with folders. The script file has the same name as the map, so the main() method within it will run automatically when you run the map.

Can you try to create a readable from script using the xdata text please?

Also, you test map is not an accurate case. Can I ask you to actually spawn the readable by user action? E.g. lever trigger, etc

Ideally I'd like to have two levers - one creates a readable from xdata and another a string hardcoded inside the script

Share this post


Link to post
Share on other sites

@stgatilov any insight?

I can see that idVarDef's are allocated on multiple storages, including the script VM stack

Significant increase of fixed string size is a clear danger

I'm thinking about adding a new setSpawnArgFmt script function that should work like Printf()

The big if is - whether the script compiler supports variable function arguments 😕

If not, maybe we can try adding smart accessors like 'My name is ${name}' since we can access script variables by name?

Share this post


Link to post
Share on other sites

I am not sure, if this is of help, but obsttorte has had released a method to create a diary/journal that is updated on certain events. You can find it here:

 

  • Thanks 1

Share this post


Link to post
Share on other sites
2 hours ago, Destined said:

I am not sure, if this is of help, but obsttorte has had released a method to create a diary/journal that is updated on certain events. You can find it here:

 

This is very clever. I just gave it a try, but unfortunately it runs into the same problem. As soon as the content of the diary reaches 128 characters, it gets truncated. 

Share this post


Link to post
Share on other sites
4 hours ago, duzenko said:

Can you try to create a readable from script using the xdata text please?

Also, you test map is not an accurate case. Can I ask you to actually spawn the readable by user action? E.g. lever trigger, etc

Ideally I'd like to have two levers - one creates a readable from xdata and another a string hardcoded inside the script

All done - check the bug report.

  • Like 1

Share this post


Link to post
Share on other sites

I have a wierd texture problem. The material file for it is below. 

This is a tile, and it's trim texture. Both are defined correctly in the material file as diffusemap, and normalmap. 
wierdly, if I used the surfacetype15, description "tile" parameter, then the main tile (black here) shows up, and
the trims (white) bumpmap is overlaid on top of the main tile (black). I've been scratching around trying to fix 
this now for 3 days and getting nowhere. The files themselves have been checked and triple checked, they are
fine, tga, no RLE compression and set to bottom left. The normals were made in njob.  Does anyone have  a clue
as to what's going wrong here?

In the console, the only reference to this material file is line 17 expected { and got textures/darkmod/... some other texture that works fine and
line 18 missing decl, but line 18 is a { ie here is line 17 and 18. These are not related to the above problem. 

textures/darkmod/stone/flat/tiling_1d/cement_002
{

venice_2020-05-05_00_35_13.thumb.jpg.a863d3a4c440f9ec49289391df40a754.jpg

 

2.jpg.3c49a3d7a5856f252cdb390f48d6d6b5.jpg1.jpg.1763389647ae4f053c374afa9ceb6b0a.jpg

this is what it's supposed to look like

 

 

textures/darkmod/stone/tiles/red_tile_flower_main_d
{
    stone
    
    diffusemap       textures/darkmod/stone/tiles/red_tile_flower_main_d
    bumpmap          textures/darkmod/stone/tiles/red_tile_flower_main_n


    // TDN Ambient Method Related
    {
        if (global5 == 1)
        blend add
        map         textures/darkmod/stone/tiles/red_tile_flower_main_d
        scale 1, 1
        red            global2
        green        global3
        blue        global4
    }
}

textures/darkmod/stone/tiles/red_tile_flower_trim_d
{
    "surftype15"
    description "tile"
    diffusemap       textures/darkmod/stone/tiles/red_tile_flower_trim_d
    bumpmap          textures/darkmod/stone/tiles/red_tile_flower_trim_n


    // TDN Ambient Method Related
    {
        if (global5 == 1)
        blend add
        map         textures/darkmod/stone/tiles/red_tile_flower_trim_d
        scale 1, 1
        red            global2
        green        global3
        blue        global4
    }
}

 

 

Edited by NeonsStyle
Adding texture images

I have an eclectic YouTube channel making videos on a variety of games. Come and have look here:

https://www.youtube.com/c/NeonsStyleHD

 

Dark Mod Missions: Briarwood Manor - available here or in game

http://forums.thedarkmod.com/topic/18980-fan-mission-briarwood-manor-by-neonsstyle-first-mission-6082017-update-16/

 

 

Share this post


Link to post
Share on other sites

@NeonsStyle 2 things to look into:

  • to be on the safe side, I'd change the names of the normalmaps so that they end in _local instead of _n. Don't forget to update the material with the new names.
  • surftype15 shouldn't be in quotation marks

Also, these files don't happen to be stored in a dds folder? If they're .tga they don't belong there.

Share this post


Link to post
Share on other sites
9 hours ago, Dragofer said:

@NeonsStyle 2 things to look into:

  • to be on the safe side, I'd change the names of the normalmaps so that they end in _local instead of _n. Don't forget to update the material with the new names.
  • surftype15 shouldn't be in quotation marks

Also, these files don't happen to be stored in a dds folder? If they're .tga they don't belong there.

Just tried that. Didn't work. Changing the file name shouldn't matter anyway, as the material file doesn't care what the 
filename is called, just what it is. Plus I don't like the _local idea as it's confusing, while trying to learn this stuff, I found it
difficult to findout what _local meant. So I use Peters method of _d for diffuse, _n for normalmap, _ed for editor image, and
_s for specularmap. 

No, the files are not in dds folders. They are in textures folder inside the fms mission folder with all the other new textures. 

I am completely stumped on this. 


I have an eclectic YouTube channel making videos on a variety of games. Come and have look here:

https://www.youtube.com/c/NeonsStyleHD

 

Dark Mod Missions: Briarwood Manor - available here or in game

http://forums.thedarkmod.com/topic/18980-fan-mission-briarwood-manor-by-neonsstyle-first-mission-6082017-update-16/

 

 

Share this post


Link to post
Share on other sites

@Dragofer

Thanks, I've looked into it, but it does not include a specific command for a line break. Indeed, moving the words around forces a line break but at the price that one receives a large space in the overall missions list.

hmm....

Share this post


Link to post
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.


×
×
  • Create New...