Tinkerer's Workshop - OXP tweaking for fun and profit!
Moderators: winston, another_commander
- Reval
- ---- E L I T E ----
- Posts: 402
- Joined: Thu Oct 29, 2020 3:14 am
- Location: At home in the Xexedi Cluster, driving an FE Asp II, Laenina's Flux.
Re: Tinkerer's Workshop - OXP tweaking for fun and profit!
Great. Thanks. And - probably a pipedream - are the prices for the last system visited (ie. the one before the current station) stored somewhere for retrieval, so that profit can be calculated?
Edit: or the contents of the player-ship's cargo hold?
Edit2: or will the playerBoughtCargo still hold that value, even after exiting witchspace and docking?
Edit: or the contents of the player-ship's cargo hold?
Edit2: or will the playerBoughtCargo still hold that value, even after exiting witchspace and docking?
Dor 'call me Grocer' Reval (a Xexedian Laver) was always considered a little backward.
- Reval
- ---- E L I T E ----
- Posts: 402
- Joined: Thu Oct 29, 2020 3:14 am
- Location: At home in the Xexedi Cluster, driving an FE Asp II, Laenina's Flux.
Re: Tinkerer's Workshop - OXP tweaking for fun and profit!
Or are any variables I set within the two functions persistent? And if not, can I make them global somehow for future reference?
Dor 'call me Grocer' Reval (a Xexedian Laver) was always considered a little backward.
- montana05
- ---- E L I T E ----
- Posts: 1166
- Joined: Mon May 30, 2016 3:54 am
- Location: lurking in The Devils Triangle (G1)
Re: Tinkerer's Workshop - OXP tweaking for fun and profit!
You can use manifest for players and cargoList for NPC's. http://wiki.alioth.net/index.php/Oolite ... p#manifest and http://wiki.alioth.net/index.php/Oolite ... #cargoList could help there.
Scars remind us where we've been. They don't have to dictate where we're going.
- Reval
- ---- E L I T E ----
- Posts: 402
- Joined: Thu Oct 29, 2020 3:14 am
- Location: At home in the Xexedi Cluster, driving an FE Asp II, Laenina's Flux.
Re: Tinkerer's Workshop - OXP tweaking for fun and profit!
Thanks. Manifest gives the quantities of all items in the hold; it doesn't seem to indicate the prices they were bought at (That's what I need to calculate profit) - is there any way to get at those? I mean, is it a question of setting global variables (if that's even possible)?
Dor 'call me Grocer' Reval (a Xexedian Laver) was always considered a little backward.
- montana05
- ---- E L I T E ----
- Posts: 1166
- Joined: Mon May 30, 2016 3:54 am
- Location: lurking in The Devils Triangle (G1)
Re: Tinkerer's Workshop - OXP tweaking for fun and profit!
Yes, you can define global variables by using this.$yourName for example. Please never forget the $ so you don't mess with the core source. If you define a script as a worlscript you can reference to it from other OXP's as well.
Scars remind us where we've been. They don't have to dictate where we're going.
- Reval
- ---- E L I T E ----
- Posts: 402
- Joined: Thu Oct 29, 2020 3:14 am
- Location: At home in the Xexedi Cluster, driving an FE Asp II, Laenina's Flux.
Re: Tinkerer's Workshop - OXP tweaking for fun and profit!
Thanks again And global arrays/lists - what's the notation for those? (I mean, is this standard Javascript? If so, I can get a lot of this info from a textbook and not have to bother people here so much )
Dor 'call me Grocer' Reval (a Xexedian Laver) was always considered a little backward.
- montana05
- ---- E L I T E ----
- Posts: 1166
- Joined: Mon May 30, 2016 3:54 am
- Location: lurking in The Devils Triangle (G1)
Re: Tinkerer's Workshop - OXP tweaking for fun and profit!
I would recommend https://www.w3schools.com/js/js_array_sort.asp for better knowledge of the js on Oolite, as much as I checked its pretty useful. Never forget that manifest or CargoList are arrays.
What I would suggest is to look at some OXP's from the past, phkb, Thargoid, Norby would come to my mind.
Scars remind us where we've been. They don't have to dictate where we're going.
- Reval
- ---- E L I T E ----
- Posts: 402
- Joined: Thu Oct 29, 2020 3:14 am
- Location: At home in the Xexedi Cluster, driving an FE Asp II, Laenina's Flux.
Re: Tinkerer's Workshop - OXP tweaking for fun and profit!
Cheers That link looks very useful. Thanks for your suggestion about delving into existing OXP js scripts too: I have been taking a look at Spara's Market Observer script and learned a bit from that. Now that I know how the globals are notated, I can learn even more from it
Dor 'call me Grocer' Reval (a Xexedian Laver) was always considered a little backward.
- montana05
- ---- E L I T E ----
- Posts: 1166
- Joined: Mon May 30, 2016 3:54 am
- Location: lurking in The Devils Triangle (G1)
Re: Tinkerer's Workshop - OXP tweaking for fun and profit!
Glad that I can help, when I joined Oolite my last (serious) language was PL/I and SQL (DB/2) so by learning from experts here and reading all the references I was able to improve, my current curse nowadays is that I don't have a budget or a deadline anymore but a lot of creativity, so I usually I implement more than necessary.Reval wrote: ↑Mon Nov 09, 2020 11:57 amCheers That link looks very useful. Thanks for your suggestion about delving into existing OXP js scripts too: I have been taking a look at Spara's Market Observer script and learned a bit from that. Now that I know how the globals are notated, I can learn even more from it
Scars remind us where we've been. They don't have to dictate where we're going.
- Reval
- ---- E L I T E ----
- Posts: 402
- Joined: Thu Oct 29, 2020 3:14 am
- Location: At home in the Xexedi Cluster, driving an FE Asp II, Laenina's Flux.
Re: Tinkerer's Workshop - OXP tweaking for fun and profit!
I can certainly relate to that I come from a Pascal and C/C++/PHP background, so I guess JS is not quite as strange to me as it must have been for you. Ditto about the oceans of time and lack of deadlines + plenty of ideasmontana05 wrote: ↑Mon Nov 09, 2020 12:13 pmGlad that I can help, when I joined Oolite my last (serious) language was PL/I and SQL (DB/2) so by learning from experts here and reading all the references I was able to improve, my current curse nowadays is that I don't have a budget or a deadline anymore but a lot of creativity, so I usually I implement more than necessary.Reval wrote: ↑Mon Nov 09, 2020 11:57 amCheers That link looks very useful. Thanks for your suggestion about delving into existing OXP js scripts too: I have been taking a look at Spara's Market Observer script and learned a bit from that. Now that I know how the globals are notated, I can learn even more from it
Oolite, it seems, is the ideal playground now, hehe...
Dor 'call me Grocer' Reval (a Xexedian Laver) was always considered a little backward.
- montana05
- ---- E L I T E ----
- Posts: 1166
- Joined: Mon May 30, 2016 3:54 am
- Location: lurking in The Devils Triangle (G1)
Re: Tinkerer's Workshop - OXP tweaking for fun and profit!
I did some Pascal and C ++ before, however, 1999 was a golden year, we had 2K and Euro, and I made more money in 6 months than in 6 years before. Enough to change my carrier and open my own business.Reval wrote: ↑Mon Nov 09, 2020 11:57 amI can certainly relate to that I come from a Pascal and C/C++/PHP background, so I guess JS is not quite as strange to me as it must have been for you. Ditto about the oceans of time and lack of deadlines + plenty of ideas
Oolite, it seems, is the ideal playground now, hehe...
Scars remind us where we've been. They don't have to dictate where we're going.
- Reval
- ---- E L I T E ----
- Posts: 402
- Joined: Thu Oct 29, 2020 3:14 am
- Location: At home in the Xexedi Cluster, driving an FE Asp II, Laenina's Flux.
Re: Tinkerer's Workshop - OXP tweaking for fun and profit!
Ahh... the '90s Good times...
Dor 'call me Grocer' Reval (a Xexedian Laver) was always considered a little backward.
- montana05
- ---- E L I T E ----
- Posts: 1166
- Joined: Mon May 30, 2016 3:54 am
- Location: lurking in The Devils Triangle (G1)
Re: Tinkerer's Workshop - OXP tweaking for fun and profit!
Scars remind us where we've been. They don't have to dictate where we're going.
- Reval
- ---- E L I T E ----
- Posts: 402
- Joined: Thu Oct 29, 2020 3:14 am
- Location: At home in the Xexedi Cluster, driving an FE Asp II, Laenina's Flux.
Re: Tinkerer's Workshop - OXP tweaking for fun and profit!
Hmmm. I dabbled in Z80 and 68000 asm way back when (Those were Atari ST days, hehe). Yes, enjoyed it but never really got into it deeply. Too much for too little, if you know what I mean
Dor 'call me Grocer' Reval (a Xexedian Laver) was always considered a little backward.
- montana05
- ---- E L I T E ----
- Posts: 1166
- Joined: Mon May 30, 2016 3:54 am
- Location: lurking in The Devils Triangle (G1)
Re: Tinkerer's Workshop - OXP tweaking for fun and profit!
Very useful in the past, going down to bits and bytes, at 64C (or Atari ST) nowadays not a much in use anymore.
Scars remind us where we've been. They don't have to dictate where we're going.