Hi Tulextreme,
Congrats for the first working script!
Great idea to follow your account at undocking! I am wondering, how it would sound, if we'd check the relative increment/decrease compared to the account state at docking, and making some comments based on that, like "Man, are you burning money?" if credits are less at undocking than docking, and "Business is running well, commander!" at the opposite state, or something like this. You could use SetState to store the account state when entering a station (if cmdr.credits is available there too). Darkcyde made a very good description about the usage of SetState earlier in this thread somewhere.
Best regards!
Sounded like a nice thing, so I wrote this up.
Add this to your 'Docked' script:
{SetState('eddi_context_docked_credits', cmdr.credits)}
{if cmdr.credits != state.eddi_context_docked_credits && state.eddi_context_docked_credits:
{_ Set bigpercent to a multiplier that represents the percent gain or loss where you would like EDDI to make a comment about a big change. I chose 1.005 initially to represent a change in my wealth of 0.5% _}
{set bigpercent to 1.005}
{_ Set smallpercent to a multiplier that represents the minimum percent gain or loss where you would like EDDI to make a comment. I chose 1.001 initially to represent a change in my wealth of 0.1%. If you choose exactly 1, EDDI should always comment on gains & losses, no matter how small. _}
{set smallpercent to 1.001}
{Pause(5000)}
{if cmdr.credits > state.eddi_context_docked_credits:
{if cmdr.credits - (state.eddi_context_docked_credits)*(smallpercent) > 0:
{set smallearn to 1}
}
{if cmdr.credits - (state.eddi_context_docked_credits)*(bigpercent) > 0:
{set bigearn to 1}
}
|elif cmdr.credits < state.eddi_context_docked_credits:
{if state.eddi_context_docked_credits - (cmdr.credits)*(smallpercent) > 0:
{set smallloss to 1}
}
{if state.eddi_context_docked_credits - (cmdr.credits)*(bigpercent) > 0:
{set bigloss to 1}
}
}
{OneOf("You", "We")}
{if smallearn:
{OneOf("earned", "cashed in")}
{Occasionally(2, "a profit of")}
{Humanise(cmdr.credits-state.eddi_context_docked_credits)} credits
|elif smallloss:
lost
{Humanise(abs(state.eddi_context_docked_credits-cmdr.credits))} credits
}
{OneOf("on", "with")}
that visit.
{Pause(100)}
{if bigearn:
{OneOf("Business is running well, {F('Honorific')}!", "Keep up the good work!")}
|elif bigloss:
{OneOf("Careful {F('Honorific')}, you are really burning money!", "Careful about the insurance rebuys!", "Careful with your cash reserves!")}
{F("Insurance check")}
}
}
{_ Set bigpercent to a multiplier that represents the percent gain or loss where you would like EDDI to make a comment about a big change. I chose 1.005 initially to represent a change in my wealth of 0.5% _}
{set bigpercent to 1.005}
{_ Set smallpercent to a multiplier that represents the minimum percent gain or loss where you would like EDDI to make a comment. I chose 1.001 initially to represent a change in my wealth of 0.1%. If you choose exactly 1, EDDI should always comment on gains & losses, no matter how small. _}
{set smallpercent to 1.001}
{Pause(5000)}
{if cmdr.credits > state.eddi_context_docked_credits:
{if cmdr.credits - (state.eddi_context_docked_credits)*(smallpercent) > 0:
{set smallearn to 1}
}
{if cmdr.credits - (state.eddi_context_docked_credits)*(bigpercent) > 0:
{set bigearn to 1}
}
|elif cmdr.credits < state.eddi_context_docked_credits:
{if state.eddi_context_docked_credits - (cmdr.credits)*(smallpercent) > 0:
{set smallloss to 1}
}
{if state.eddi_context_docked_credits - (cmdr.credits)*(bigpercent) > 0:
{set bigloss to 1}
}
}
{OneOf("You", "We")}
{if smallearn:
{OneOf("earned", "cashed in")}
{Occasionally(2, "a profit of")}
{Humanise(cmdr.credits-state.eddi_context_docked_credits)} credits
|elif smallloss:
lost
{Humanise(abs(state.eddi_context_docked_credits-cmdr.credits))} credits
}
{OneOf("on", "with")}
that visit.
{Pause(100)}
{if bigearn:
{OneOf("Business is running well, {F('Honorific')}!", "Keep up the good work!")}
|elif bigloss:
{OneOf("Careful {F('Honorific')}, you are really burning money!", "Careful about the insurance rebuys!", "Careful with your cash reserves!")}
{F("Insurance check")}
}
}
Note that you can adjust how often EDDI comments by adjusting the variables 'bigpercent' and 'smallpercent'.