Torn City Guides

Torn Profile Filter - Difficulty Editing
Submitted by tn5421 [276835] on 13/07/17 11:03:42 PM - Last editted on 17/03/18 09:16:54 PM

Torn Profile Filter - Difficulty Editing

This is a guide for [script] Profile Info.  The information within may be useful to you in any case, but it was written specifically for said script.  Use at your own risk.

As promised, an explanation on how to edit the default difficulties is here!

 

Adding and Editing difficulty settings

You'll scroll down to lines 16-21, which will show this:

    const tag_colors = {
        tbd: 'inherited',
        easy: 'rgba(161, 248, 161, 1)',
        medium: 'rgba(231, 231, 104, 1)',
        impossible: 'rgba(242, 140, 140, 0.7)'
    };

What you'll want to do is add further options to this list. The only one that absolutely has to stay as it is would be the initial option, so that people are not automatically tagged before you know their difficulty.

Here is an example of what the tags looked like in the old Warbase script.

var TAGS = { // Feel free to add additional tags as needed.
tbd: {text: 'Difficulty', color: 'inherit'},
easy: {text: 'Easy', color:'rgba(161, 248, 161, 1)'},
moderate: {text: 'Moderate', color:'rgba(153, 255, 102, 1)'},
medium: {text: 'Medium', color:'rgba(231, 231, 104, 1)'},
hard: {text: 'Hard', color:'rgba(255, 153, 51, 1)'},
impossible: {text: 'Impossible', color:'rgba(242, 140, 140, 1)'}
};

Which should/will look like this in the new script:

    const tag_colors = {
        tbd: 'inherited',
        easy: 'rgba(161, 248, 161, 1)',
        moderate: 'rgba(153, 255, 102, 1)',
        medium: 'rgba(231, 231, 104, 1)',
        hard: 'rgba(255, 153, 51, 1)',
        impossible: 'rgba(242, 140, 140, 0.7)'
    };

Adding your new settings to the dropdown list

You'll be searching for lines 181-186 (Or, if you've already put the above into action, lines 183-188)

It should look like this:

<select id="difficulty-dropdown" style="margin: 0px 10px 0px 0px" onchange="update_difficulty(this)">
<option ${initial_manual_difficulty === 'tbd' ? 'selected="selected"' : ''} value="tbd">Difficulty</option>
<option ${initial_manual_difficulty === 'easy' ? 'selected="selected"' : ''} value="easy">Easy</option>
<option ${initial_manual_difficulty === 'medium' ? 'selected="selected"' : ''} value="medium">Medium</option>
<option ${initial_manual_difficulty === 'impossible' ? 'selected="selected"' : ''} value="impossible">Impossible</option>
</select>

You will want to add another row for each additional difficulty you add.  For example, to add the difficulties I added above, "Moderate" and "Hard", you would add these lines:

<option ${initial_manual_difficulty === 'moderate' ? 'selected="selected"' : ''} value="moderate">Moderate</option>

<option ${initial_manual_difficulty === 'hard' ? 'selected="selected"' : ''} value="hard">Hard</option>

As you see, you have to add the short name you use at the start of the script twice, as well as the label you want it to use.

<option ${initial_manual_difficulty === 'short_name' ? 'selected="selected"' : ''} value="short_name">The label AKA what you actually see in the dropdown list on Torn.com</option>

Which should look like this if you put them together.  The Order IS Important

<select id="difficulty-dropdown" style="margin: 0px 10px 0px 0px" onchange="update_difficulty(this)">
<option ${initial_manual_difficulty === 'tbd' ? 'selected="selected"' : ''} value="tbd">Difficulty</option>
<option ${initial_manual_difficulty === 'easy' ? 'selected="selected"' : ''} value="easy">Easy</option>
<option ${initial_manual_difficulty === 'moderate' ? 'selected="selected"' : ''} value="moderate">Moderate</option>
<option ${initial_manual_difficulty === 'medium' ? 'selected="selected"' : ''} value="medium">Medium</option>
<option ${initial_manual_difficulty === 'hard' ? 'selected="selected"' : ''} value="hard">Hard</option>
<option ${initial_manual_difficulty === 'impossible' ? 'selected="selected"' : ''} value="impossible">Impossible</option>
</select>

Save the script and reload whatever page(s) you are on.  You should see the new difficulty settings in your dropdown list.

Changing the width/height of the comment box

To change the width or the height of the comment box, look at this line

<textarea id="difficulty-notes" rows="10" cols="50">${initial_notes}</textarea>

Columns being width and rows being height.  I personally prefer 3 rows and 85 columns because this moves the import/export buttons below the text field and makes better use of the width available.

 

 

 

 

 

 

 

 

 

 

 

 

 

Depreciated content below.

Unfortunately, the old tags use RGBA and the new tags use Hex. Not to worry, we have an rgb to hex converter available for our use. We'll simply discard the '1' at the end since that's not terribly important for what we are doing.

We will enter the values left to right into the website, and the website will spit out a hex code that we will use soon, so write them down.

I typed in red: 161, green: 248, blue: 161 and was given #A1F8A1. It also shows you what the color looks like. Write down the following so we know what tag it's for:

Easy: #A1F8A1

We will do this for every tag first, so we have all the data available when we go to edit the new script. Once we have done that, then we will add to the list.
If you do not have tags set up already, generally the scale of colors used ranges from deep green for very easy to blood red for impossible.

difficulty_select.innerHTML = `
Select Difficulty
Easy`

The option tag creates a dropdown entry. The value, in this case, determines the cell's color. And the text in between the > and the < is what you see when you click the dropdown menu. You can add as many as you so desire, so long as it makes sense to you, and so long as they are enclosed in backticks (aka the ` mark). This is necessary so that the whole list is considered to be a single entity, otherwise you won't get your whole list of tags.

This page has been viewed 1,178 times.