Re: Education
Posted: Thu Jan 06, 2022 11:27 pm
For information and discussion about Oolite.
https://bb.oolite.space/
Code: Select all
this.name = "Education_Station_Bar.js";
this.author = "Cholmondely";
this.copyright = "(C) 2022 Cholmondely";
this.licence = "CC-NC-by-SA 4.0";
this.description = "This OXP does nothing at all yet.";
this.version = "0.1.1";
"use strict";
// Having a "Visit the Station Bar" on the F4 Screen might be a way to go for that. This script would let you give a randomly picked item each time. Although you might want to also add a timer so the messages change over time. You could also add tests for Government type, economy or station type so different items are overheard in different systems types and station types.
// Set Up your F4 Screen Option Like this:-
this.shipDockedWithStation = function(station) {
this.barinterface();
}
this.removebar = this.shipWillLaunchFromStation = function() {
player.ship.dockedStation.setInterface("bar_chatter",null);
}
// Now Add your Visit the Bar Interface like this:-
this.barinterface = function() {
player.ship.dockedStation.setInterface("bar_chatter",{
title: "Visit the Station Bar",
category: "Activities",
summary: "Useful gossip can sometimes be overheard in the Bar",
callback: this.showBar.bind(this)});
};
// Now add this code so that when the Visit the Bar Option is selected Oolite will randomly pick one of the messages you have set up in descriptions.
this.showBar = function() {
mission.runScreen({
title: "The Local Bar",
screenID:"show_bar",
var text = expandDescription("[education_bar_gossip]");
message: text;
}
Code: Select all
this.name = "planner.js";
this.author = "Ramen";
this.copyright = "(C) 2015 Ramen";
this.licence = "CC-NC-by-SA 3.0";
this.description = "This OXP doesn't do very much yet.";
this.version = "1.0.0";
"use strict";
this._tempVal = "";
this.startUpComplete = function()
{
if (!missionVariables.planner_planNames)
{
missionVariables.planner_plans = JSON.stringify({});
missionVariables.planner_planNames = JSON.stringify({"1_EXIT":
"Exit."});
}
this._plans = JSON.parse(missionVariables.planner_plans);
this._planNames = JSON.parse(missionVariables.planner_planNames);
this.$dockedCheck();
}
this.shipDockedWithStation = function()
{
this.$dockedCheck();
this.playerWillSaveGame();
}
this.playerWillSaveGame = function()
{
missionVariables.planner_plans = JSON.stringify(this._plans);
missionVariables.planner_planNames = JSON.stringify(this._planNames);
}
this.$dockedCheck = function()
{
player.ship.dockedStation.setInterface("Planner",
{ title: "Planner",
category: "Info",
summary: "A Planner for "+
"'Real life' or Oolite",
callback:
this.$planner.bind(this)});
}
this.$planner = function()
{
mission.runScreen({
title: "Planner",
message: "Choose an option.",
choicesKey: "planner_options"},
this.$choice);
}
this.$choice = function(choice)
{
if (choice == "1_ADD")
{
mission.runScreen({
title: "Planner",
message: "Enter subject. (30 char. max)",
textEntry: "TRUE"},
this.$subject);
}
else if (choice == "2_REMOVE")
{
mission.runScreen({
title: "Planner",
message: "Choose plan to remove.",
choices: this._planNames},
this.$remove);
}
else if (choice == "3_VIEW")
{
mission.runScreen({
title: "Planner",
message: "Choose a plan.",
choices: this._planNames},
this.$view);
}
else
{
return;
}
}
this.$subject = function(choice)
{
this._tempVal = choice;
mission.runScreen({
title: "Planner",
message: "Enter details. (30 char. max)",
exitScreen: "GUI_SCREEN_INTERFACES",
textEntry: "TRUE"},
this.$details);
}
this.$details = function(choice)
{
if (choice == "")
{
return;
}
this._plans[this._tempVal] = choice;
this._planNames[this._tempVal] = this._tempVal;
}
this.$remove = function(choice)
{
if (choice == "1_EXIT")
{
return;
}
delete this._plans[choice];
delete this._planNames[choice];
player.consoleMessage(choice + " removed.");
}
this.$view = function(choice)
{
if (choice == "1_EXIT")
{
return;
}
mission.runScreen({
title: choice,
message: "Details:\n" + this._plans[choice]});
}
Code: Select all
this.setInterface = function() {
player.ship.dockedStation.setInterface("LITF_hangarScreen",
{
title: "Disembark from your ship",
category: "Activity",
summary: "Visit the station",
callback: this.$enterStation.bind(this)
}
);
};
Code: Select all
// establishes the F4 interface for switching laser mounts while docked
this.$initInterface = function $initInterface(station) {
// can only move lasers if there is more than one mount to move them between
// 0 = none, 1 = forward only
if (player.ship.weaponFacings > 1) {
station.setInterface(this.name, {
title: "Laser arrangement",
category: "Ship Systems",
summary: "Allows lasers to be moved between the different mounts available on the ship.",
callback: this.$showInitial.bind(this)
});
} else {
station.setInterface(this.name, null);
}
}
Thanks! I'll give it a whirl tonight.spara wrote: ↑Sun Jan 16, 2022 11:22 am1. Rename "world-script.plist" to "world-scripts.plist"
2. Remove "," from world-scripts.plist
3. Fix whatever there is wrong in the "this.showBar" function.
I did 1 & 2 + commented the internals of the "this.showBar" function and the Station Bar appeared in the F4 screen. After launch and dock of course.
So I commented out the internals (lines 34-38) and the option to visit the station bar finally appeared on my F4 screen. The only thing, was that I couldn't "select" it! So I'm still doing something wrong there. But a stage further forwards. Nothing obviously wrong in the latest.logCholmondely wrote: ↑Sun Jan 16, 2022 1:05 pmThanks! I'll give it a whirl tonight.spara wrote: ↑Sun Jan 16, 2022 11:22 am1. Rename "world-script.plist" to "world-scripts.plist"
2. Remove "," from world-scripts.plist
3. Fix whatever there is wrong in the "this.showBar" function.
I did 1 & 2 + commented the internals of the "this.showBar" function and the Station Bar appeared in the F4 screen. After launch and dock of course.
Step forward indeed To make the function actually do something, try this:Cholmondely wrote: ↑Tue Jan 18, 2022 4:30 pmSo I commented out the internals (lines 34-38) and the option to visit the station bar finally appeared on my F4 screen. The only thing, was that I couldn't "select" it! So I'm still doing something wrong there. But a stage further forwards. Nothing obviously wrong in the latest.log
Code: Select all
this.showBar = function() {
mission.runScreen({
title: "The Local Bar",
screenID:"show_bar",
message: "foo"
})
}
Code: Select all
this.startUpComplete = this.shipDockedWithStation = function(station) {
...
Thanks, seriously! Still coming up with ideas for the conversations (and have a couple from Redspear/Murgh to include)...spara wrote: ↑Wed Jan 19, 2022 4:47 pmStep forward indeed To make the function actually do something, try this:When you get that working, link it to the description.plist by altering that "foo" there. Oh, and to make bug-fixing and tweaking a bit faster, you might want to add this.startUpComplete as an extra event for adding the interface. Just change the first function to this:Code: Select all
this.showBar = function() { mission.runScreen({ title: "The Local Bar", screenID:"show_bar", message: "foo" }) }
Code: Select all
this.startUpComplete = this.shipDockedWithStation = function(station) { ...
Sure it feasible. You can easily check for the presence of an oxp and act accordingly. I would start with general gossip first though. I would create a list of converstations to the descriptions.plist and let the game randomly expand from those. If needed, I'll provide some example code for you.Cholmondely wrote: ↑Wed Jan 19, 2022 5:19 pmIs it feasible to detect what oxp's are being used and add in relevant tips which only show up then?