Saying hello

More
19 years 6 minutes ago #14241 by mdvalley
Replied by mdvalley on topic Saying hello
Welcome to the modding community! If there’s anything you need to know, just ask.

The true language of EoC is in the PKG files. We just have a converter kindly provided by PS that will write them. Granted, it has a few bugs (variable++ throws a syntax error, and the =+ function does not work as advertised (took me hours of debugging to find that bastard)).

I have to admit that POG is the only language I know.

My little niche in this community is tSpewerOps, the first mod for Torn Stars. It allows the player's cargo ships to use the station pod spewer. Its source is available, and I can point out exactly what any of its lines does. I’m quite proud of it, really.

I’m currently working on tMegaTrucking (yes, that’s the actual package name), which will add support for the massive megafreighters to tSpewerOps. It has nearly twice the lines, more than twice the functions, and, um, a minor bug that keeps you from jumping one through an L-Point. Need to fix that one. And ever watch an AI one unload? It takes forever. Try it with 240 pods sometime. Snore. I got an idea on how to speed up that one.

Having no experience in C, I don’t have any frustrations with the differences to POG. I just find ways to make it do what I want. For example, I need the megapods to remember what minipods they have where. So I gave them each eight handle properties, one for each slot, pointing to the minipod in that slot. I’m quite possibly the only POG programmer stupid enough to make an object property with the name of a generated string, but it works.

Please Log in or Create an account to join the conversation.

More
18 years 11 months ago #14243 by MajorTom
Replied by MajorTom on topic Saying hello

Originally posted by mdvalley

I’m quite possibly the only POG programmer stupid enough to make an object property with the name of a generated string, but it works.


Nope, I'm just as "stupid" ;)

I used the same technique quite a while ago to store and reset the ammo loadout of a destroyed ship when it respawns in the Star Wars MP game mod. (Before that respawning gave you a full ammo complement so some players got themselves shot intentionally to get their missle racks reloaded). It works for that too flawlessly

Anyhow, I think POG has some eccentricities that can make you very creative. If you try to use techniques from other languages though you'll probably get pretty frustrated (except maybe BASIC). [xx(]

Iwar2 Multiplayer Fan Site

Please Log in or Create an account to join the conversation.

More
18 years 11 months ago #14244 by mdvalley
Replied by mdvalley on topic Saying hello
BASIC? BASIC was my first language. Apple 2 BASIC, to be precise. Y’know, where you needed line numbers and functions were called with a GOSUB? Didn’t include it as BASIC as I know it is, well, dead.

Don’t really see how the property-name-is-generated trick works for the weapon thing. What I’m talking about is:
Code:
atomic { while(!foundfree) { if(Object.HandleProperty(megapod, SlotFromInt(freeslot)) == none) foundfree = true; else --freeslot; if(freeslot < 1) return; } Object.SetHandleProperty(megapod, SlotFromInt(freeslot), minipod); if(!Object.PropertyExists(minipod, "md_epic_slotin")) Object.AddIntProperty(minipod, "md_epic_slotin", freeslot); else Object.SetIntProperty(minipod, "md_epic_slotin", freeslot); podwatch = start pod_watch(minipod, megapod, Task.Current()); }

That little gem searches for and reserves a free spot on the megapod. (int freeslot starts at 8, btw). SlotFromInt(int slot) returns “md_epic_slot� with a number on the end. (e.g. SlotFromInt(5) returns “md_epic_slot5�). So Object.HandleProperty(megapod, SlotFromInt(i)) will get me the handle of the pod in slot i. In many places in my code, I have to check through the contents of a megapod via a loop. Beats a case-switch by far.

Looking back on that chunk, I don’t think the foundfree variable is really necessary. Makes it easier to read, though.

In an attempt to get the thread back on track, this is the kind of thing us POG geeks discuss.

Please Log in or Create an account to join the conversation.

More
18 years 11 months ago #14249 by GrandpaTrout
Replied by GrandpaTrout on topic Saying hello
POG has some very nice features, such as lists and sets as native data types.

To create a data structure you allocate an object (like a ship) and then attach properties to the object. It is not hard, just slow to code. And slow to access. Each object property is an atomic data types. No arrays, only lists.

Saving an object is a matter of reading each of these properties and writing them out as "globals". Globals are not really global variables, they are more like tiny disk files accessed through a library.

Debugging is done through print statements. This makes tracking down crashes a matter of trial and error. But not impossible.

All that said, it is still fun enough to keep me trying it. There is just something cool about writing some code and seeing objects pop into existance and move in response. It is addictive.

Please Log in or Create an account to join the conversation.

More
18 years 11 months ago #14269 by pr0fez
Replied by pr0fez on topic Saying hello
Just wanted to add that I've updated my contact information with IM info if you want to chat or whatever. I'm a linux-user so that means I have all accounts in the same client, choose one of your liking (icq, y!, msn, jabber)

(wasn't any row for msn, but my msn account is corsoski-at-hotmail-dot-com)

Oh, I don't generally read email to any other addresses than the one listed in my profile, so don't bother sending email to the addresses provided through the im services (ie yahoo, hotmail etc). At least not if you want me to read it :)

| Raphael aka pr0fez
| Observe the Power of Syntactic Sugar!

Please Log in or Create an account to join the conversation.