Hetzner has confirmed a network outage. Connectivity to Wurm may be degraded or intermittent while they complete repairs.
Sign in to follow this  
joedobo

[Released] simplify ccfp by maxing, ScriptRunner example

Recommended Posts

For this mod, because I think ccfp is stupid, I made it so my ccfp values are basically always maxed. 

 

Required

-Ago's server modloader

-You need to have the scriptrunner mod installed and setup as explained on github wiki page:

https://github.com/ago1024/WurmServerModLauncher/wiki/Mods-ScriptRunner

 

Install

1. Copy the javaScript code from the code box.

2. Paste that into any simple text editor.

3. Save the file and I named this, "ccfp-maximizer.js". You could use whatever name you want as long as its unique and it ends with ".js".

4. Put it in the directory, "~Wurm Unlimited Dedicated Server\mods\scriptrunner\scripts\onItemTemplatesCreated". If the, "onItemTemplatesCreated" folder doesn't exists, create it.

5. Change the values for carbs, calories, fats or proteins if you want something different.

 

var ItemTemplateFactory = Packages.com.wurmonline.server.items.ItemTemplateFactory;
var Logger = Packages.java.util.logging.Logger;
var logger = Logger.getLogger("com.joedobo27.scriptRunnerMods.ccfp-maximizer");

function onItemTemplatesCreated() {
    var templates = ItemTemplateFactory.getInstance().getTemplates();
    var maxValue = Packages.java.lang.Short.MAX_VALUE;
	//***************************************************
	// Use maxValue to max and 0 to minimize.
	var carbs = maxValue;
	var calories = maxValue;
	var fats = maxValue;
	var proteins = maxValue;
	//***************************************************

    for (i = 0; i < templates.length; i++) {
        templates[i].setNutritionValues(carbs, calories, fats, proteins);
    }
	logger.info("CCFP simplified, template count: " + templates.length);
}

 

Take note that ccfp values are scaled based on a standard unit size of 1-kg. A pumpkin is 32k and a garlic 1.6k because its .05 or 5% of 1kg. I'm not sure what is going on with fish but weights and sizes for them seems constantly strange.

Edited by joedobo

Share this post


Link to post
Share on other sites

I don't understand any of this, but i'm sure someone else does lol.

 

what I would like is some kind of tutorial that allows me to make "decorative" items for wurm, as in 3d models, I have a few ideas but I am not familiar with how it all goes to gether, I know ausimus did a wall decoration of sorts, I would like to do something like that, so I can cover up my timber frame and instead give them a plastered look.

 

sorry don't mean to hijack just saying a tutorial on this sort of stuff would help those who are clueless on this stuff lol

Share this post


Link to post
Share on other sites

I don't get how this is difficult to understand.

 

1. Copy the code in the white box,

2. Paste into a text editor program (notepad, wordpad, notepad++, ....).

3. Save as a something with .js extention.

4. Put that file in the appropriate folder: Wurm Unlimited Dedicated Server\mods\scriptrunner\scripts\ onItemTemplatesCreated.

 

 

@ozmods I know nothing about making graphics. I'd like to see something like that also because I want to make or get a graphics pack that focus on super simplified polygon counts and teeny tiny texture resolution meshes. One relevant aspect of this and the OP is that the code below for making item templates is "public" in the code so I think you could use the script runner to add new items to the game: 

ItemTemplateFactory.getInstance().createItemTemplate(...)

 

Share this post


Link to post
Share on other sites

what if I want carbs and proteins to be maxxed as well? where/what would I change? 

Share this post


Link to post
Share on other sites

@Vanyel , Hopefully this is a little more clear how to use it. 

var ItemTemplateFactory = Packages.com.wurmonline.server.items.ItemTemplateFactory;
var Logger = Packages.java.util.logging.Logger;
var logger = Logger.getLogger("com.joedobo27.scriptRunnerMods.ccfp-maximizer");

function onItemTemplatesCreated() {
    var templates = ItemTemplateFactory.getInstance().getTemplates();
    var maxValue = Packages.java.lang.Short.MAX_VALUE;
	//***************************************************
	// Use maxValue to max and 0 to minimize.
	var carbs = maxValue;
	var calories = maxValue;
	var fats = maxValue;
	var protiens = maxValue;
	//***************************************************

    for (i = 0; i < templates.length; i++) {
        templates[i].setNutritionValues(carbs, calories, fats, protiens);
    }
	logger.info("CCFP simplified, template count: " + templates.length);
}

 

Edited by joedobo

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.

Sign in to follow this