Editing a specific fruittype literpersqm

Seen 398 times - 0 Members and 1 Guest are currently viewing this thread

Pages: [1]
  Print  
pops64
Newbie
Joined December 2016
United States United States



« on: December 17, 2016, 09:52:53 pm »

So here is the code
Code:
function E:calculateFruitType()
    local L=FruitUtil.fillTypeToFruitType[self.fillTypeId]
    if L~=nil then
      local M=FruitUtil.fruitIndexToDesc[L]
      if M~=nil then
         self:setLiterPerSqm(M.literPerSqm)
        self:setSeedUsagePerSqm(M.seedUsagePerSqm)
      end
    end
  end;

What I am trying to do is self:setLiterPerSqm(M.literPerSqm) sends 0.96 for the straw fill type I need it to change it to 2.329 for just straw and leave the rest of the fill types alone. This isn't my mod I am just trying to tweak it to get rid of this error. And I can't seem to find anything that fits this specific problem and I only sort of understand FS scripiting. Thanks for the help
Logged
theSeb
MVP
Joined September 2012
United Kingdom United Kingdom



« Reply #1 on: December 18, 2016, 12:02:49 am »

It's hard to understand the context without seeing the full thing and knowing just what could be happening in those two functions and what you are using for self.fillTypeId but to set literpersqm and seedUsagePerSqm is pretty easy. There is a mod on modhoster which does this, which you could use.

or

Code:
--assuming that your index is correct
  FruitUtil.fruitIndexToDesc[fruitIndex].literPerSqm = newValueThatYouWant
  FruitUtil.fruitIndexToDesc[fruitIndex].seedUsagePerSqm = newValueThatYouWant

 -- for a specific fruit the easiest thing to do is
  FruitUtil.fruitTypes["barley"].literPerSqm = newValueThatYouWant
« Last Edit: December 18, 2016, 01:32:22 am by theSeb » Logged
pops64
Newbie
Joined December 2016
United States United States



« Reply #2 on: December 18, 2016, 01:56:23 am »

The mod converts the store prices into a standardize form that way it is easy to compare price across fruit types the only problem is the value used to convert the straw price is not correct(0.96). It converts the store price by multiplying current store price with the literPerSqm value. I have tried with no luck
Code:
if FruitUtil.fruitIndexToDesc["straw"] then
self:setLiterPerSqm(2.3290130103)
elseif not FruitUtil.fruitIndexToDesc["straw"] then
 self:setLiterPerSqm(M.literPerSqm)
end

i have also tried

Code:
FruitUtil.fruitIndexToDesc[L] == FruitUtil.fruitIndexToDesc["Straw"]
Logged
theSeb
MVP
Joined September 2012
United Kingdom United Kingdom



« Reply #3 on: December 18, 2016, 02:27:08 am »

what is the mod name?
Logged
pops64
Newbie
Joined December 2016
United States United States



« Reply #4 on: December 18, 2016, 03:17:39 am »

Commodity Price its on modHub, I just want to tweak it for personal use. Have fun looking at it, original programmer removed all line breaks and went with alphabet soup for variables. Thanks for helping me out.
Logged
pops64
Newbie
Joined December 2016
United States United States



« Reply #5 on: January 12, 2017, 04:09:50 am »

For any using this mod and looking to edit in the way I have descriped. In the bootstrap.lua find
Code:
self.literPerSqm=J
and replace this with
Code:
if self.displayName == 'Straw' then self.literPerSqm = 2.3290130103; else self.literPerSqm=J; end;
You could also change Straw to any of the other names shown in game and 2.3290130103 with anything you would like
Logged
Pages: [1]
  Print  
 
Jump to:  

Back Top of page
  Powered by SMF 1.1.21 | SMF © 2013, Simple Machines