[Depricated] Trumble Treats - coming soon!

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: another_commander, winston

User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1878
Joined: Tue Jun 07, 2005 7:32 pm
Location: [%H] = Earth surface, Lattitude 52°10'58.19"N, longtitude 4°30'0.25"E.
Contact:

Post by Arexack_Heretic »

yay! My ignorance feeds the pyres of change and progress once more! ;)

Got my shoes, my keyboard and a packet of green putty, also had a litre of beer or so...it's like the swamps of Diso out there! (or was it Inrere? No OO on this labtop. :p))

Later tonight, I'll get to integrating above legacy plist material with the js mission variables, so that profit will vary and will be mentioned in the sales proposal.
I think I'll have two values the basic rate which will be used in the mission screen and the final price after haggling which wil determine the ...um... profit.

Also I'll have the fines for getting caught be relative to the gov't type of the system, I think. (they are now small fixed values, as profit was also fixed.)

--
Just had a thought to loop the punishment script for the most severe punishment, untill the player has no more EQ_TRUMBLE_IN_BOX left.
...will need to find out how to determine the number of a EQ_type, for the sentence screen.
Riding the Rocket!
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5525
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

Currently (s)he'll only be able to have one EQ_TRUMBLE_IN_BOX - the only equipment you can have multiples of are pylon-mounted kit. Hmm, have I just given inspiration for a pylon-mounted trumble? :twisted:

But what you could do is use the purchase of an EQ_TRUMBLE_IN_BOX to increment a missionVariable counter, and then remove the equipment. That way multiple purchases could be simulated (and you could limit it if you wanted by having availability conditional that the mV is less than a certain maximum count). Then also the number you have would be readily available as the mV value.

It would mean also that they wouldn't show up on the equipment list (and so be combat-damagable), but you could list them on the F5-F5 screen using a mission short description tag or something. Works all around really...
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1878
Joined: Tue Jun 07, 2005 7:32 pm
Location: [%H] = Earth surface, Lattitude 52°10'58.19"N, longtitude 4°30'0.25"E.
Contact:

Post by Arexack_Heretic »

I don't like it, but it might prove neccesary as being limited to a single trumble for sale wouldn't work.

Maybe I could just set a mV_# to a specific number once the EQ is bought (may have several EQ, that are incompatible, that grant different numbers of boxes to sell.) the mV is decremented by each sale/confiscation untill it reaches zero, at which time script could remove the TBOX_EQ.
edit: shipyard just requires eq_trumbles, and is removed as soon as bought hopefully, incrementing a missioncounter.


Won't a f5f5 mission descriptor interfere with other mission scripts using this page?
Last edited by Arexack_Heretic on Tue Jul 20, 2010 9:29 pm, edited 1 time in total.
Riding the Rocket!
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5525
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

Arexack_Heretic wrote:
Won't a f5f5 mission descriptor interfere with other mission scripts using this page?
No - you can set one short listing in the F5-F5 screen per script. The only problem comes when you have too many OXPs (scripts) running that do and the screen overflows. But that's rare, and the player's own fault and problem.

If you have the box as "true" equipment, then it will show up on the equipment list (on the status F5 screen) and in combat there would be a chance that it could get damaged (although soon if not now you'll be able to control that iirc).

If it were me I'd do it via the mV as I outlined, but it's your concept...
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1878
Joined: Tue Jun 07, 2005 7:32 pm
Location: [%H] = Earth surface, Lattitude 52°10'58.19"N, longtitude 4°30'0.25"E.
Contact:

Post by Arexack_Heretic »

I'm going with your suggestion, but it means everything will need to be rewritten.
I found the expand description reference here by the way, under global.
(I'm looking for a list of the triggers, such as when does this.startUp() run? once on load, when the worldscripts are run I suppose.
edit: Ah, yes before demo runs.
Riding the Rocket!
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5525
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

World Script and ship script event handlers, just for reference.

This.startUp() runs as you say whenever the world scripts are run - when the game first loads, when you load a saved game and when the game restarts after you die.
User avatar
myst.RAVEN
Dangerous
Dangerous
Posts: 65
Joined: Tue Jun 29, 2010 12:36 pm
Location: Johannesburg, South Africa, Earth, Sol System

Post by myst.RAVEN »

Arexack_Heretic wrote:
Like a thick accent. (More like Afrikaans v Dutch actually, as some basic stuff are just plain different)
An interesting analogy - I'm from South Africa, so I know exactly what you mean :D (Yes, off-topic, I know, but it's just that I doubt all that many people are familiar with Afrikaans...)
.
Commander MultiplePersonalityDisorder: Flying around various galactic sectors, in a variety of ships, with a variety of lifestyles and professions...

Full throttle and fuel injectors - now THAT's the way to park!
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1878
Joined: Tue Jun 07, 2005 7:32 pm
Location: [%H] = Earth surface, Lattitude 52°10'58.19"N, longtitude 4°30'0.25"E.
Contact:

Post by Arexack_Heretic »

Whot?! Even with the FIFA world soccer cup held at your place?

Oh well, must be the historic connection that makes Afrikaans interesting for us hollanders. :)

edit:
Almost ready with rewriting to the second concept. I'll not be testing tonight, dat bedone on the morn.

I'll just make a start with having trumbles turn to fur when prepared.
edit^2:
Just realised something: free fur. I wanted to make getting rid of eq_trumble impossible as long as you have trumble in box onboard... will the free fur from trumbles be off balance, or will it just create a new career path: the furtrader? [spoiler] (you do need to buy food and let them multiply for a while)[/spoiler]

Another thing: how does the 'while' loop function in JS?
I assume something like:

Code: Select all

while (missionVariables.My_number<10)
{missionVariables.My_number+=1;}
Riding the Rocket!
User avatar
Svengali
Commander
Commander
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

Post by Svengali »

Yep. that's the way it works.

And a interesting page about loops -> http://4umi.com/web/javascript/optimize.php
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post by Kaks »

Hmm, beats me why, but it seems a few people are keen to use the missionVariables object.

They're good (well, the only option, so not awful by definition) for storing information onto a save game, but they're bad for everything else: every single time you use a missionVariable, it'll slow down your OXP considerably.

Please use proper javascript variables instead, whenever possible. You'll thank me later! :twisted:
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1878
Joined: Tue Jun 07, 2005 7:32 pm
Location: [%H] = Earth surface, Lattitude 52°10'58.19"N, longtitude 4°30'0.25"E.
Contact:

Post by Arexack_Heretic »

you mean like:

var i = value

or plain

x = value

? Ive seen both uses in oxp JS.

edit: the loop example link posted above uses the former. I see it advocates processing loops in batches, interesting notion. I'm not going to use that i suspect, simplicity is what I like. My code will only run the loop below 100 times, and only for one rare event, as it handles jailtime a slowdown might actually be beneficial to immersion. :P
The net profit of several microseconds per hours of playtime would hardly be noticable though.

---
I could use temporary variable for storing the trumblenumber before getting fried, but I'd have to add lines for creating it at launch as well. small issue.

For storing the number of boxes onboard, I'd rather use the saved variables, they are already a step less permanent than the actual equipment objects that I would have preferred.

I'll considder your advice though. I am using the missionvariables to store localized information as well.... those values are used in the missiontexts...If using Var, the text script is going to get a bit more complex I fear.

Also I hereby dub you my honorary Murgh. ;)
eg. my JS mojo is still weak compared to yours.... I will be relying on you guys, Thargoid and Kaks (edit and Erik W), to make optimisation suggestions etc. :)
...if not rewrite the entire script! :lol:
Last edited by Arexack_Heretic on Wed Jul 21, 2010 12:54 pm, edited 3 times in total.
Riding the Rocket!
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Kaks wrote:
Please use proper javascript variables instead, whenever possible. You'll thank me later! :twisted:
Ah, you mean the difference between:

Code: Select all

> :time {missionVariables.My_number = 0; while (missionVariables.My_number<10) {missionVariables.My_number+=1;}}

Total time: 100.881 ms
JavaScript: 0.178317 ms, native: 100.703 ms
and

Code: Select all

> :time {var i = 0; while (i<10) {i+=1;}}

Total time: 0.004892 ms
JavaScript: 0.004892 ms, native: 0 ms
it is only a difference of 100 msec. Almost nothing, a blink of an eye. (Don't express it in percentages as it looks like it takes several 1000 times longer.)
EDIT: Changed the starting value from 10 to 0
Last edited by Eric Walch on Wed Jul 21, 2010 2:02 pm, edited 1 time in total.
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post by Kaks »

Didn't you 'break' Murgh? Can I be someone else? :D

Anywho, yes I mean var i; (and/or var i=something;)

Code: Select all

x = something;
normally means it's declared as a variable at some other point earlier on in the code. To use js variables you first need to declare them (either with var or with the less standard let)

There's a number of nice js primers online. Have a look at the 12 'javascript basics' articles you can see from this page, they should clarify quite a few things, and better than I could ever do:

http://www.htmlgoodies.com/primers/jsp/

some of them are exclusively talking about html specific stuff like part 6 or 7, so I'd ignore those, but quite a lot of the rest talks about the language itself, as found inside Oolite! :)
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1878
Joined: Tue Jun 07, 2005 7:32 pm
Location: [%H] = Earth surface, Lattitude 52°10'58.19"N, longtitude 4°30'0.25"E.
Contact:

Post by Arexack_Heretic »

Thanks, that is a great resource!

I'd looked (admittedly only briefly) online for JS for dummies, primers, for beginners, JS fundamentals or similar, but they all seemed to focus on webpages and HTML interaction whatever. Not very clear. The information found on our own OO-wiki was far superior. :)

Don't worry about Murgh, I'll be more gentle with you, I promise. :twisted:


edit:
that said, i have a question:
in order to award furs for removing all trumbles, I need an eventtrigger.
at first I thought to use a close to sun aegis, but that does not exist.
then, I thought to use cabinheat, but that is just a value, not a trigger.
my current target is this trigger, as in principle I need only check when the EQ_TRUMBLE is lost. (I assume it counts as destroyed)
So at entering a system(and launching), the value of trumbleCount is saved in a variable. When an EQ is destroyed*, a check is made for EQ_T, if not present, if the trumblevariable has a value, award a Tn of fur/grand of trumbles. (I assume excess cargo is simply lost, but could also award cargo equal to ship.cargoSpaceAvailable)... can't find the reference to awardCargo anywhere...I'll check what was done to make our cargo oxp work.
*could add temperature condition here as well to reduce superfluous checks.
edit2: Oh yeah, my question. The reference states worldscript only, what does this mean ?
edit3: nevermind, I figured it out: missionscripts are called from worldscript, thus are worldscript.
Riding the Rocket!
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Arexack_Heretic wrote:
at first I thought to use a close to sun aegis, but that does not exist.
It does, try adding in your code:

Code: Select all

this.shipEnteredPlanetaryVicinity = function(planet)
{
    if(planet.isSun)
        log("test","Player enters aegis of sun with radius: "+ planet.radius) 
    else if(planet.hasAtmosphere)
        log("test","Player enters aegis of planet with radius: "+ planet.radius) 
    else
        log("test","Player enters aegis of moon with radius: "+ planet.radius) 
}
At least in 1.74 it will work for the sun.
EQ_TRUMBLE is lost. (I assume it counts as destroyed)

Won't work, as this equipment is immediately removed again when infected.
can't find the reference to awardCargo anywhere
Changed with 1.74. look at manifest now. Unlike the old method, you can now also remove cargo.
Post Reply