Jump to content
  • 0

SMW questions and help


hishutup

Question

I created this template which is very much unfinished because I always wanted to give it a shot and I figured this may be a good time.

I don't know about you but this is very complex and my poor variable naming skills are really shining.

 

I want what you think. Is there a way to optimize some of the code. There are parts that can be broken off into other templates like the list thing. Now come to think of it, I think it should.

 

This should for any of the guides that are out there. If there is something specific that you want then I'll add it but right now my brain hurts because of this mess.

 

I'm not going to rip out code so that the template become more generic because I developed it for myself, I will add though. I can make another one if it desired

 

Soon to come:

My mod install procedure.

variable header tags.

Link to comment
Share on other sites

  • Answers 175
  • Created
  • Last Reply

Top Posters For This Question

Recommended Posts

  • 0

The use of that property is not dependent on SMW. It can just as easily be solved by using a Category. SMW is about providing associations of information for pages. Categories work far better for the purpose of identifying like pages because they are searchable using standard MW, and SMW properties are not. Not everything needs to be a SMW property, and they should be used appropriately. Uses of properties that are deemed useless and a waste, I will remove at my discretion.

 

There is more to it then meets the eye. I use that particular property to store a list of mods that are currently in the guide.

There is a block of code that is in the Dev:TES4Templates/ModList that uses the list of mods and compares it to a list of requirements/incompatibilities that are stored in the mod dictionary(TES4Mod pages).

The one I am talking about can probably be optimized but I spent several hours trying to get this to work.

{{#arraymap:{{#show:{{{modName}}}|?OblivionRequirements}}|,|%%%%|{{#arraymap:{{#show:{{FULLPAGENAME}}|?{{BASEPAGENAME}}_{{SUBPAGENAME}}}}|,|^^^^|{{#ifeq:{{#varexists:b%%%%{{{modName}}}}}|1|{{#ifeq:{{#var:b%%%%{{{modName}}}}}|1|{{#ifeq:%%%%|^^^^|{{#vardefine:b%%%%{{{modName}}}|2}}}}}}|{{#vardefine:b%%%%{{{modName}}}|1}} }} |}} |}}{{#ifeq: {{#show:{{{modName}}}|?OblivionDLC}}{{#show:{{{modName}}}|?OblivionRequirements}}|||<li><span style="color: orange; font-size:1.15em;">'''Requirements:'''</span> <ul> {{#if: {{#show:{{{modName}}}|?OblivionDLC}}|<li>{{HoverText|DLC|{{#show:{{{modName}}}|?OblivionDLC}}}}</li>}}{{#arraymap:{{#show:{{{modName}}}|?OblivionRequirements}}|,|%%%%|{{#ifeq:{{#var:b%%%%{{{modName}}}}}|2|<li>[[#%%%%|%%%%]]</li>{{#vardefine:b%%%%{{{modName}}}|0}}|{{#ifeq:{{#var:b%%%%{{{modName}}}}}|1|<li>%%%%</li>{{#vardefine:b%%%%{{{modName}}}|0}}|}}}}|}}</ul>}}

Hmm, as I am looking at this again, I could encapsulate the initial variable assignment in the if statement in the second pass because currently its trying to do an arraymap on a void. I'll fix that soon enough.

There is also a reason for two passes because if there was only one pass then I would get two list items that are the same: one without an internal link and one with and internal link.

 

 

I am aware that not everything needs to be a property. I'm trying to figure out what should and what shouldn't be a property. Once, I start working on a revision, I will have better documentation and explanations so that you could help me optimize the code that is going on, if you feel like it that is.

If you happen to look through anything and have suggestions then feel free but I dont have everything documented because I change my mind too often at this point in time because I finish a one part of code and then read up or discover an entirely new way to do things.

 

Uses of properties that are deemed useless and a waste, I will remove at my discretion.

Before you do that can you give me a heads up. I'll fix anything that is incorrect. At this point I have a list of ideas that I want to implement but I dont always know the best way.

 

 


 

Can SMW properties be parsed with a dependent value from a templates field?

Not sure what you mean, could you elaborate more.

I am unsure what I even meant. I think I had a train of thought at the time but then realized that it wouldn't work

 

 

No for a template, but you can for a field. Use a checkbox and then specify the field you want to show when it's checked, and it needs to be wrapped in a div. Example:

 

{{{field|enable|input type=checkbox|show on select=reveal}}}

<div id="reveal">{{{field|reveal}}}</div>

 

Hmm, I didnt understand what they meant by "show on select" but that clears some stuff up. I also really need to take a look at those div tags.

 

 

The Discourse DB site has plenty of examples that I need to take a second look through.

Link to comment
Share on other sites

  • 0

 

 

You don't need to store the list of mods on a page in a property. All you need to do is query the page for the list of mods being used.

Im trying to understand precisely what you are telling me to do and I think I am misunderstanding what you are saying.

I dont know how to query if something is on a page.

This ask that will return the entire dictionary of mods, including the two bogus pages.

{{#ask: [[Category:TES4Mod]]}}

What am I missing that will return a list of mods that exist on that page.

Link to comment
Share on other sites

  • 0

You don't need to store the list of mods on a page in a property. All you need to do is query the page for the list of mods being used.

 

he wanted me to navigate away from SMW properties for this particular issue and use a query instead but I dont know how he would want it done.

 

Link to comment
Share on other sites

  • 0

Actually, scratch what I said. I took a closer look at what you are doing. Clever, but my god is that hard to follow.

 

Sub objects would be a better method of managing the mod use on the page. Take a look at STEP:ModList and related templates for an example. This would allow you to easily query for every mod being used on the page and it would be a far cleaner format. Would have to dig into that logic to better understand how subobjects could be tied in though.

Link to comment
Share on other sites

  • 0

Trust me, its because there are no carriage returns or tabs. I could probably break a lot of the code up into separate templates and that would simplify everything. Not simplify but make it easier to read.

Here is that function expanded, easy to read but bad for wiki

https://pastebin.com/cG2NVYtY

 

I'll take a look a subobjects. I was briefly looking at it and it seems interesting.

 

I cannot find the subobject example you are talking about because they all seem to be deleted.

 

I took another look and I can use that for so many things but I just dont know how it works.

 

 

EDIT: I wish that there was some sort of server side stats. I am running a lot of parser functions but I dont know how heavy it is.

Link to comment
Share on other sites

  • 0

Sorry, wrong page. Each release of STEP gets its own page by version.
 
STEP:ModList/2.2.9 contains the template calls, and the form uses multiple instance templates to generate the list of mods for each section.
 
An example is calling Template:ModOrderSectionB, and each mod that is added uses Template:ModOrderSectionBItems. Inside the items template a subobject is used to store the mod name (ModName sub property) specific to the STEP version (Version sub property) and the section they are in (Section sub property). The list of mods can then be queried for the version as a whole:
 
 

{{#ask: [[Version::2.2.9]]
|mainlabel=-
|?ModName=
|link=none
}}

 
Or narrowed down to a specific section:
 
 

{{#ask: [[Version::2.2.9]] [[Section::B]]
|mainlabel=-
|?ModName=
|link=none
}}

For the guide, you could create the subobject in the template:
 

{{#subobject:-
|GuideName={{PAGENAME}}
|ModName={{{modName}}}
}}

Then you can query on the guide name itself to get the list of mods.

 

We don't make server stats public. As for performance, you only pay the cost on a page/template edit/purge. That has other implications based on the complexity of how something is setup and the number of jobs that would be required to update all of the dependencies.

Link to comment
Share on other sites

  • 0

I have to be missing something because that is one of a dozen ways to do the same thing.

 

It just creates two properties. I thought that there was more to it then that. I could do the same with my current setup and have one less parser function. Yes, the current setup is poor but it works at this point in time. Ill get it down to a single pass in a rewrite which will help.

 

Is there any way I can see what my pages are doing or is it completely restricted to only Admins.

I dont know how taxing each parser function is.

 

 

...sigh, the I got kinda screwed by my own property. :/

I do see that there are several locations were this project can be optimized.

Link to comment
Share on other sites

  • 0

Being able to do something multiple ways is one thing, but it's about identifying the simplest and most maintainable solution.

 

The subobjects are not creating multiple properties, it's wrapping information inside a pseudo object. You also need to consider maintainability. If you were done with this project, how easy would it be for you to pick it back up in 6 months? How easy it would it be for someone else to pick it up when looking at it for the first time?

 

In terms of performance, using the subobjects would be less taxing than the chain of arraymap calls you are currently using.

Link to comment
Share on other sites

  • 0

sigh, I created another rogue property, my bad...

 

Hmm, interesting...

 

I think I need to keep playing with it. I could implement the subobjects to keep everything together.

Like: Game, Guide, ModName

There are probably other things that I can use that for.

Do the names in the subobject affect other properties. They totally do.

 

 

 

 You also need to consider maintainability. If you were done with this project, how easy would it be for you to pick it back up in 6 months? How easy it would it be for someone else to pick it up when looking at it for the first time?

I am aware of it but at this point I am also unaware of the best solution. There are various niche solutions that I will likely not find a use for until you mention it.

The problem with those questions is that the person that wrote it will likely be able to remember it for quite some time but someone that wants to pick it up will likely have zero clue whats going on because they didnt write it nor did they participate in the creation.

 

 

About the whole dev server. Is it basically a blank wiki environment where project can be worked on or is it like the Dev: where you can have multiple namespaces.

 

If I can start experimenting with using different namespaces then that would be pretty cool.

Link to comment
Share on other sites

  • 0

Trust me when I tell you that even the person that writes it will forget much of what they did a month later and thereby have to relearn it all again ;)

 

... it will come back to that person more quickly though.

 

Writing SMW this way is definitely convoluted and testing the limits of the intended scope of SMW.

 

Caching does not make dev any easier either!

 

@s4n

Once we set up the dev wiki, I think in the config, we should DISABLE caching of all kinds ... grrr. ... and set up some simple scripts that can be executed to keep things clean and facilitate dev/debugging.

Link to comment
Share on other sites

  • 0

 

 

Caching does not make dev any easier either!

Agreed.

95% everything works great but that one time when you accidentally forget closing brackets or curly braces then everything breaks. Its hilarious for a second but then you realize that you have to find the issue and even after you fix it there are still some broken pieces everywhere. Like the two bogus pages, the various broken properties and some other non working remnants scattered around the wiki.

 

If I could run a script every time I broke something that would be great but that will likely not be something that I have access to. :/

Link to comment
Share on other sites

  • 0

Caching is a problem because it is a real barrier to getting immediate feedback to SMW tweaks ... so you can develop on top of a mistake before realizing it or even perform a bogus 'fix' before realizing it ... either way, you are hard-pressed to develop or debug efficiently unless you never make any mistakes.

 

I am an intuitive thinker, so I develop everything (in SMW and other syntactical languages) with a great deal of "tweak > view" iterations, attenuating on the correct solution, given the feedback of such a process. I am sure everybody does this to more or lesser degree.

Link to comment
Share on other sites

  • 0

When I was doing the arraymap nonsense I used all sorts of "debugging" code which consisted of various characters as well as variables. It helps but eventually I got to a point where I can just look at the issue and know what the problem and solution is because I had already "debugged" the issue before.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Guidelines, Privacy Policy, and Terms of Use.