Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - liuqixind123

#1
Help / Re: How to write my own UI in Rimworld?
March 22, 2022, 12:04:34 PM
Thank you, gonna learn it right away.
#2
Quote from: Azedia_404 on February 21, 2022, 07:25:13 PM
First of all this is the first mod I'm doing for practice, I'm interested in creating mods for Rimworld, but I don't understand why PatchOperationReplace doesn't work as I believe it should, more information below.

Here is a print that shows how it looks in the game.
https://prnt.sc/XVvD9cRV7bCQ

here is the XML that applies the replace, I didn't put the whole code because it would be too big here.


<li Class="PatchOperationReplace">
<xpath>/Defs/RecipeDef[defName = "Make_yy_ammo_primitive"]/ingredients</xpath>
<value>
<ingredients>
<li>
<filter>
<thingDefs>
<li>WoodLog</li>
</thingDefs>
</filter>
<count>15</count>
</li>
<li>
<filter>
<thingDefs>
<li>VMEu_Iron</li>
<li>VMEu_Bronze</li>
</thingDefs>
<categories>
<li>StoneBlocks</li>
</categories>
</filter>
<count>15</count>
</li>
</ingredients>
<fixedIngredientFilter>
<thingDefs>
<li>WoodLog</li>
<li>VMEu_Iron</li>
<li>VMEu_Bronze</li>
</thingDefs>
<categories>
<li>StoneBlocks</li>
</categories>
</fixedIngredientFilter>
<defaultIngredientFilter>
<thingDefs>
<li>WoodLog</li>
<li>VMEu_Iron</li>
<li>VMEu_Bronze</li>
</thingDefs>
<categories>
<li>StoneBlocks</li>
</categories>
</defaultIngredientFilter>
</value>
</li>


change :
<li Class="PatchOperationReplace">
to:
<Operation Class="PatchOperationReplace">
#3
Quote from: GhostData on January 30, 2022, 05:37:57 PM
The code you're looking for is the class Rule_String, which more or less
1. Uses Match to match the ruleStrings you see in the XML file to a very scary looking Regex - This essentially breaks the string in xml down into a key, a collection of parameters, and an output value.
2. Parse all of the params and validate that they are correct
3. Store the parsed values in the fields of Rule_String


These are later referenced to determine how and what to display when logging social interactions - this is a grammar used to define and parse log entries.

Now for what p=3 means: It's the "weight" of that element. By default, every list item will have a weight of 1, but p=x will set the weight of that specific element to some other number.
The short version is that higher weighted strings are more likely to be selected.

Thank you, that explains very clearly. It did huge help.
#4
Help / How to write my own UI in Rimworld?
March 17, 2022, 02:09:05 PM
Quick question: How to write your own UI in game?
I have written several mods with C# and that is really fascinating. Plentiful of wonderful mods have their UI (ie. In Androids, once you click print android there will be a window pops out for you to customize your own android), and I am planning to write a fate grand order like game feature.So the UI thing is very necessary.

Rimworld is built with Unity and i know there exist a few classes in Verse class to build the UI like Window class. Just dnspyed it and found that is a hell mess with really long code. Probably that is not just being written directly. So the question is How to build my own UI? Any tool can help me with that? Is there any tutorial?
#5
In interactiondefs ->Defs->InteractionDef->logRulesInitiator->rulesStrings,
there are many <li> elements and i see this:
<li>gamePTD01bj(p=3)->traitor</li>

What is this (p=3)? I thought it was some kind of xml feature and google it , of course no clue.
So i guess it is some kind of "repeatable elements",p=3 means it will be equal to show up for 3times.
This is stupid guess no doubt, so could anyone tell me what that is?