Updating the wiki mission scripting tutorial

zonkmachine
Posts: 30
Joined: Mon Sep 20, 2021 3:18 pm

Re: Updating the wiki mission scripting tutorial

Post by zonkmachine »

This snippet in data/modules/ gives me frequent crashes. I wonder if it is a version of https://github.com/pioneerspacesim/pioneer/issues/5233

Code: Select all

Fatal: [string "[T] @libs/SpaceStation.lua"]:144: attempt to index field '?' (a nil value)
stack traceback:
	[string "[T] @libs/SpaceStation.lua"]:144: in function 'GetEquipmentStock'
	[string "[T] @modules/crashongetstock.lua"]:9: in function 'cb'
	[string "[T] @libs/Event.lua"]:34: in function '?'
	[string "[T] @libs/Event.lua"]:185: in function <[string "[T] @libs/Event.lua"]:180>==9903== Syscall param writev(vector[...]) points to uninitialised byte(s)

Code: Select all

local Comms = require 'Comms'
local Event = require 'Event'
local Equipment = require 'Equipment'
local ui = require 'pigui'

local onShipDocked = function (ship, station)
  if ship:IsPlayer() then
    Comms.Message("Number of ECM units in stock: " ..
            station:GetEquipmentStock(Equipment.misc.ecm_basic))
  end
end

Event.Register("onShipDocked", onShipDocked)
zonkmachine
Posts: 30
Joined: Mon Sep 20, 2021 3:18 pm

Re: Updating the wiki mission scripting tutorial

Post by zonkmachine »

I've started to move the 'Flavour' chapter from 'Interacting with the player: BBS forms' to 'Strings and translation'
Old chapter removed saved a copy here for easy comparison: https://pioneerwiki.com/wiki/Zonkmachin ... avours_OLD
New addition: https://pioneerwiki.com/wiki/Strings_an ... n_flavours

The old chapter is, well really old so I don't know what can be salvaged from it.

q - Is this still valid?
If my current language is not English, and there are no flavours in that language, English flavours will be used instead. If there is only one flavour in my language, I will only see that one variety.
Edit: I eventually removed the old part in the BBS forms page
Last edited by zonkmachine on Fri Oct 15, 2021 11:29 am, edited 1 time in total.
zonkmachine
Posts: 30
Joined: Mon Sep 20, 2021 3:18 pm

Re: Updating the wiki mission scripting tutorial

Post by zonkmachine »

Updating updates...
Fixed up 'Interacting with the game' to use onShipDocked instead of onGameStart to avoid issues. Also fleshed out the examples some.
New: https://pioneerwiki.com/wiki/Interactin ... rogramming
Old: https://pioneerwiki.com/wiki/Zonkmachin ... amming_OLD
zonkmachine
Posts: 30
Joined: Mon Sep 20, 2021 3:18 pm

Re: Updating the wiki mission scripting tutorial

Post by zonkmachine »

@impaktor I believe you mentioned on the chat that someone eventually could be working on an update of Interacting with the player: BBS forms Was this correct? and if so who?
I've looked at the parts that are left after cutting out two of them and they're actually not in that bad shape. Most of all new screenshots are needed. The code snippets pretty much works and what doesn't.
I'll have a go at it tonight.
impaktor
Posts: 992
Joined: Fri Dec 20, 2013 9:54 am
Location: Tellus
Contact:

Re: Updating the wiki mission scripting tutorial

Post by impaktor »

zonkmachine wrote: Wed Oct 13, 2021 8:20 pm q - Is this still valid?
If my current language is not English, and there are no flavours in that language, English flavours will be used instead. If there is only one flavour in my language, I will only see that one variety.
I'd separate the discussion on language translation from flavour as they're not really the same / related, and might cause confusion:

- language is about storing the strings in variables, that are read from json-files, where the real string resides, and how transifex makes a copy of the values for each language, and putting each in a separate new json file. Also: how to insert varialbes in these strings. E.g. "Its {distance} ly away".

- flavour is merely how to let the scrip choose multiple different versions of a variable with text.

@impaktor I believe you mentioned on the chat that someone eventually could be working on an update of Interacting with the player: BBS forms
Yes, sturnclaw (on IRC). He's posted screenshots in the past of the current state. Possibly Nozmajner might have mockups approximating the plan.

I wonder if we could have a page / cemetary of old UI stuff, to document (for fun/nostaligia) old screens. I semi-did that on the article about our three different UI systems. Anyway, having up-to-date screen shots is nice, but we'll (hopefully) keep iterating and making them better continously, so they might get outdated again shortly (assuming people keep contributing).
impaktor
Posts: 992
Joined: Fri Dec 20, 2013 9:54 am
Location: Tellus
Contact:

Re: Updating the wiki mission scripting tutorial

Post by impaktor »

@zonkmachine, also regarding the crash, please play using, which fixes the crash, and rebalances markets, especially as you progress up in ship-size: https://github.com/pioneerspacesim/pioneer/pull/5291
impaktor
Posts: 992
Joined: Fri Dec 20, 2013 9:54 am
Location: Tellus
Contact:

Re: Updating the wiki mission scripting tutorial

Post by impaktor »

Btw, where are the preliminary changes comming to BBS, (from April, this year I see):
https://imgur.com/a/spYtVWw
zonkmachine
Posts: 30
Joined: Mon Sep 20, 2021 3:18 pm

Re: Updating the wiki mission scripting tutorial

Post by zonkmachine »

impaktor wrote: Sun Oct 17, 2021 7:07 am Btw, where are the preliminary changes comming to BBS, (from April, this year I see):
Looks good! I'm going to go ahead and fix it up to todays standard and then sneak back and update it later if needed.
impaktor wrote: Sun Oct 17, 2021 7:01 am @zonkmachine, also regarding the crash, please play using, which fixes the crash, and rebalances markets, especially as you progress up in ship-size: https://github.com/pioneerspacesim/pioneer/pull/5291
OK. With those changes applied I no longer see a crash, but instead I get a supply of 0 in the Comms message when there is actually ECM units in there. I think I saw that before, once or twice, but now it's much more frequent.
impaktor
Posts: 992
Joined: Fri Dec 20, 2013 9:54 am
Location: Tellus
Contact:

Re: Updating the wiki mission scripting tutorial

Post by impaktor »

You get a message in comms if you try to buy ECM? Sounds very strange.

I don't think that PR touches ECM in ship equipment market in any way, nor comms.
zonkmachine
Posts: 30
Joined: Mon Sep 20, 2021 3:18 pm

Re: Updating the wiki mission scripting tutorial

Post by zonkmachine »

impaktor wrote: Sun Oct 17, 2021 7:18 pm You get a message in comms if you try to buy ECM? Sounds very strange.
Wait. In your comment:
impaktor wrote: Sun Oct 17, 2021 7:01 am @zonkmachine, also regarding the crash, please play using...
I assumed that you meant the crash I describe here:
viewtopic.php?p=6869#p6869

The code that misbehaves (presented after the crash log) I print the ECM stock to the Comms terminal.

Code: Select all

Comms.Message("Number of ECM units in stock: " .. station:GetEquipmentStock(Equipment.misc.ecm_basic))
With the code you linked to I no longer see that crash. I do however see sometimes that the stock is set to 0 even though there are units for sale if I look in the Equipment Market.
Post Reply