------------------------------------------------------------------------- STARDOCK LOCO - Expansion module help for programmers - IGM's ------------------------------------------------------------------------- You are welcome to write any code that you wish for Stardock Loco's expansion module features, as long as you give me credit, and you do not charge more than the cost of Stardock Loco - if you create a module that you wish to have them register. I would like to have a look at it for approval, to make sure it stays within the game story, and doesn't trash a BBS's game files. I do _not_ require any $$ from the proceeds of your module(s). But if you want, send it over... The module must run from one of the expansion module areas in the game. If you create a module, upload it to the support bbs, and I like it, I will send you a registration key for yourself or for your favorite BBS. It doesn't necessarily have to be a great or large module by any means, just something creative and interesting. I'm pretty easy on the standards! Heck, this is all for fun anyway! See the very bottom of this file for the support bbs numbers and how to get in touch with me if you need help. There are many IGM/expansion module areas: * The Upstairs and Downstairs portions of Terran Pete's Slush Bar. * The Other Places area in the ShipYards. (30 slots) * The area on board a players ship: Go for a cruise. * The Blackmarket. at the Main Menu. * Favrie Colony IGM slots. (5 slots) NEW: * Sickbay, Weaponshop, Armorshop, Terran Pete's, Sleeping Pods, Bank, Nehrus, Other Aliens. Feel free to create new places for the following: These are accessed: Sickbay: sb??????.exe WeaponShop: ws??????.exe ArmorShop: as??????.exe Terran Petes: tp??????.exe Sleeping Pods: sp??????.exe Bank: bk??????.exe Nehru's Arena: na??????.exe Other Aliens: oa??????.exe If you drop an .exe into the SDL directory with the beginning letters of the above, it will bypass my code for those areas. Your IGM will appear instead. Give it a try by copying roid.exe to sbroid.exe and you will see what I mean. IGM Necessary Information: --------------------------------------------------------------------------- SDLoco was created using Brian Pirie's Opendoors program. If you are unfamiliar with this C library, I recommend that you download it from a BBS, and register it if you are going to use his library. You may NOT attach a module that uses a library or program that is unregistered that interfaces with a modem, a BBS, and with Stardock Loco. I accept no responsibility for your program and/or its uses! :) ---------------------------------------------------------------------------- NEW ADDITION: I have just added MODULE.C to the stardock zip file. It contains the full source of the blkmkt1.exe to get you started easier on a mod. Just trying to make it easier on all of us...:) You may want to read the code below, to get a little more insight, and see why I did what..... Feel free to use module.c as a starting point for your module. You can create a new black market that runs from that slot, but you must include the armor and weapon upgrades as part of your black market. Note: It is written using Brian Pirie's Opendoors serial comm door program, and cannot be compiled without the odoorh.lib. But, you can change that easily if you have another program that you use. See the MODULE.C for more information. That slot is accessed by blkmkt?.exe, the question mark being the number or letter that you or I add to it. The version included with sdloco is blkmkt1.exe. -------------------------------------------------------------------------- The Shipyards Expansion Slots -------------------------------------------------------------------------- If you create a module, it would be a good idea to include a description for the Sysop to type into the sd_add.exe program. Or you can write an easy install, and add it yourself. See the structure of the module.lst file below. (waaaay below..) <--this only applies to the shipyards module area! ------------------------------------------------------------------------- Terran Pete's module slots ------------------------------------------------------------------------- For the upstairs/downstairs area, no description is necessary. All that you must do is begin the module name with: dn To run from Downstairs up To run from Upstairs Example: DNmymod.exe <--it must end with .exe -And then dump it in the sdloco directory. I use the C function _dos_findfirst to look for the module. I am using the wildcard characters in the following way: up*.exe dn*.exe Whatever you put between the up/dn and the .exe doesn't matter to me. Do note that it looks for the first occurence of an "up" or a "dn", and will run that module. If there are other modules in the directory, it will run the _first_ one it finds. Make sure to notify the sysop of this, and tell them about removing another up/dn module, and possibly renaming it and adding it to the shipyard module area using the sd_add.exe. ------------------------------------------------------------------------- On board the ship module slot Go for a cruise ------------------------------------------------------------------------- For the on-board the ship area, no description is necessary. All that you must do is begin the module name with: nd Example: ndMymod.exe <--it must end with .exe -And then dump it in the sdloco directory. This one is accessed from the Go for a cruise part of the menu. Feel free to create a new ending for the game if you wish! Or take 'em for a ride to the center of the universe...I dinna care! Once again, I am using _dos_find_first! See the Terran Pete's module slot reference about this. ------------------------------------------------------------------------- Favrie Colony * New Developments Area ------------------------------------------------------------------------- This area is for those of you that wish to create a planet based IGM. There are 5 slots. You will have to create a text file for the description of your module. Just open an editor such as dos edit, and type in your description on the first line. You have a 50 character line you can use. If you like, you can colorize your description with the following: `red` For bright colors: `blue` add bright: `yellow` example: `bright red` `cyan` `green` Here is an example description: `bright green`Into the Jungles of Favrie. <-this will show up on the menu as a bright green item. The ` is very important. The modules and description files are as follows: 1fc*.exe 2fc*.exe 3fc*.exe <-IGM names 4fc*.exe 5fc*.exe 1fc*.dsc 2fc*.dsc 3fc*.dsc <-Description files 4fc*.dsc 5fc*.dsc -And then dump it in the sdloco directory. They will then run from the corresponding <1> <2> etc from the New Develop- ments menu on the Favrie Colony. I use the C function _dos_findfirst to look for the module. I am using the wildcard characters in the following way: 1fc*.dsc 1fc*.exe 3fc*.dsc, etc. Anything between the first three letters and the . are yours to add. I don't look at them or worry about them. If there are other modules with the same first 3 letters in the directory, it will run the _first_ one it finds. Make sure to notify the sysop of this, and tell them about removing the other favrie module, and possibly renaming it and adding it to the shipyard module area using the sd_add.exe, or renaming yours to another module such as 5fcMymod.exe/.dsc. ------------------------------------------------------------------------ For all module areas: ------------------------------------------------------------------------ Try to make the program install and un-install in a minute or less. Save the Sysop all the hassle you can! They're busy ya know! NOTE WELL: * You must have exclusive file access if you access my player file! See the C version of the exclusive file access I have included. ABOUT ME: I am a new C programmer, as you experienced C people may notice in some of the following code. As a student at DeVry in Phoenix, Az, I decided to really learn C the first day of the C class. So, I wrote this sucker in the following month. I learned some C. While the rest of the class was doing printf, I was banging away at spawning other programs, and doodling in memory allocation and serial comm. They hate me... So, you may notice some weird stuff in the code that is in this text file. I didn't change some of it because it worked, even though I found out later that it wasn't the _best_ way. But it werked at the time, and werks now. Expect nicer cleaner stuff soon..... And, thanks for reading this, and playing Stardock Loco. If you know how to write stuff, please add on to the game. It would be tremendously cool to have a lot of nice add-ons that are full featured games that work together!! It could make it _the_ game to have! All of this is in C, if you don't know C, it shouldn't be too tough for you Pascalites, or other language types with a big book. ------------------------------------------------------------------------- Expansion Modules: All areas, Terran Pete's/Shipyard Modules/On ship ------------------------------------------------------------------------- I make the expansion modules separate entities from the game. When they run the module, Stardock Loco is swapped to disk. Your module then takes control of any modem interfacing. When they return, Stardock then checks to see if the player's lifepoints are greater than 0. If so, they continue the game. If not, they are sent back to the BBS. The module is spawned similar to the spawnvpe function in C. (Opendoors 5.0 od_spawnvpe function). What I pass to the module is the *path* to the door.sys or whatever type the door file is for the BBS. That file contains all the information that is required for the door. (od_control structure for Opendoors users). Then I extract the player's real name from the door file. Note: If the game is run in local mode, I pass a switch of /L in the argv. This causes the Sysop to log into the module....(gonna change that!) When the player goes to the modules, I look up their real name, then when the match is found, run the module. If it isn't found, that is a major error, and they return... The favrie.exe Colony has it's own special player file. fav_pl.lst. See the example waaaay at the bottom of this file. FILE AND CODE INFORMATION: //Also see MODULE.C (Blackmarket) *****************READ THIS, EVEN IF YOU'RE USING MODULE.C!!*************** --------------------------------------------------------------------------- The main player file as defined in C: player.lst --------------------------------------------------------------------------- The player.lst is saved in text format. I then convert the player to the correct integer and long values that I need in the game. (Don't ask why..) //size definitions #define MAXNAME 30 #define MAXBBSNAME 36 #define MAXWEAPONNAME 20 #define MAXARMORNAME 20 #define MAXSTANDARDLONG 10 #define MAXSTANDARDINT 4 struct player { char on_now[MAXSTANDARDINT+1]; //If they are currently on-line = 1 char name[MAXNAME+1]; //Game name char bbs_name[MAXBBSNAME+1]; //Real name char living[MAXSTANDARDINT+1]; //if alive = 1, dead = 0 char killer[MAXNAME+1]; //Who killed them char location[MAXSTANDARDINT+1]; //Where they are. 1=Terran Pete's // 2=Pods char lifepoints[MAXSTANDARDLONG+1]; //lifepoints char lifepointsttl[MAXSTANDARDLONG+1]; //Total lifepoints char weapon[MAXWEAPONNAME+1]; //Weapon name char weapon_energy[MAXSTANDARDLONG+1]; //Current amount of Energy Packs char weapon_strength[MAXSTANDARDINT+1]; //Weapon strength i.e. 1, 2, 3, 4 etc. char max_packs[MAXSTANDARDLONG+1]; //Total energy packs gun will hold char weapon_status[MAXSTANDARDINT+1]; //if owns weapon = 1 char weapon_cost[MAXSTANDARDLONG+1]; //Weapon's value char armor[MAXARMORNAME+1]; //Armor Name char armor_strength[MAXSTANDARDLONG+1]; //Strength of Armor char armor_status[MAXSTANDARDINT+1]; //if they have armor = 1 char armor_cost[MAXSTANDARDLONG+1]; //Armor Value char credits[MAXSTANDARDLONG+1]; //credits on hand char bank_credit[MAXSTANDARDLONG+1]; //credits in Guido's Bank char pod[MAXSTANDARDINT+1]; //if own a pod = 1 //SOMEBODY CRUISE THIS SHIP ALL OVER THE GALAXY PLEASE!!! //Battles! Trading, quests, exploration, planets, stars... char ship[MAXSTANDARDINT+1]; //if own a ship = 1 // 2=I'stellar cruiser char ship_name[MAXNAME+1]; //name of ship char ship_type[MAXSTANDARDINT+1]; //type of ship. 1=garbage scow // 2=I'stellar cruiser char mt[MAXSTANDARDINT+1]; //has a matter transmitter =1 char arkon_bomb[MAXSTANDARDINT+1]; //has a bomb = 1 char level[MAXSTANDARDINT+1]; //player level char experience[MAXSTANDARDLONG+1]; //Experience char kills[MAXSTANDARDINT+1]; //kills. <-used on asteroid. Turns used. char droids[MAXSTANDARDINT+1]; //number of droids char passkey[MAXSTANDARDINT+1]; //number of passkeys //globals char on_off[MAXSTANDARDINT+1]; //if droids armed = 1 char sickbay_closed[MAXSTANDARDINT+1]; //if sickbay closed = 1 char bank_closed[MAXSTANDARDINT+1]; //if bank_closed = 1 char pickpocket[MAXSTANDARDINT+1]; //pickpocketed nurse wetley char tipcnt[MAXSTANDARDINT+1]; //how many times stolen tips char owns[MAXSTANDARDINT+1]; //owns weaponshop = 1 //owns armorshop = 2 //owns both = 3 char fights[MAXSTANDARDINT+1]; //fights used today char last_played[MAXSTANDARDINT+1]; //day last played. (stardate) }; That big mess is converted to this in the game: struct on_line_player { int on_now; char name[MAXNAME+1]; char bbs_name[MAXBBSNAME+1]; int living; char killer[MAXNAME+1]; int location; long lifepoints; long lifepointsttl; char weapon[MAXWEAPONNAME+1]; unsigned long weapon_energy; int weapon_strength; unsigned long max_packs; int weapon_status; unsigned long weapon_cost; char armor[MAXARMORNAME+1]; unsigned long armor_strength; int armor_status; unsigned long armor_cost; unsigned long credits; unsigned long bank_credit; int pod; int ship; char ship_name[MAXNAME+1]; int ship_type; int mt; int arkon_bomb; int level; unsigned long experience; int kills; int droids; int passkey; int on_off; //reset daily by extern: //from defaults.... int sickbay_closed; //killed staff int bank_closed; //angered guido int pickpocket; //picked N. Wetlys pocket int tipcnt; //max tips taken int owns; //1 owns weapon shop, 2 owns armor shop int fights; //fights used today int last_played; //stardock days running }; -------------------------------------------------------------------------- Favrie Colony player list: fav_pl.lst -------------------------------------------------------------------------- If you wish to use the special skills that the player has gotten on the colony, or any other stuff, here it is: Expect this to change if I expand the colony. struct fahvrie { unsigned long cillenium; //how much cillenium they have found int skill; //skill 1 = nard kick, 2 3 4 5 6 7 8 9 //if they are a level 4, they can use 4,3,2,1 int mine_turns; //turns used in the mine int fight_turns; //turns used in the nightclub int fights; //total fights in the nightclub // important to raise skill level. unsigned long bank_credit; }; As stored in the fav_pl.lst, text format: struct p_file { char name[MAXNAME+1]; //Real Name char cillenium[MAXSTANDARDLONG+1]; ///////////////////////// char weapon[MAXWEAPONNAME+1]; /// <<-not used yet char mine_turns[MAXSTANDARDINT+1]; /// Same as above char complex_turns[MAXSTANDARDINT+1]; /// <<-not used yet char nightclub_turns[MAXSTANDARDINT+1]; /// char bank_credit[MAXSTANDARDLONG+1]; /// char fight_turns[MAXSTANDARDINT+1]; /// char skill[MAXSTANDARDINT+1]; /// char fights[MAXSTANDARDINT+1]; //////////////////////// char exp2[MAXSTANDARDINT+1]; //expansion slot <-not used yet. char date; //date last played. date<<_dos_getdate }; -------------------------------------------------------------------------- module.lst record definition -------------------------------------------------------------------------- I've added this for those of you that wish to add an easy install for the sysop that automatically adds your module into the module.lst for the ShipYards expansion area. Please include an easy un-install as well. #define MAXPATH 36 // length of fields in entry box #define MAXDESCRIPTION 40 struct record { char path[MAXPATH]; char description[MAXDESCRIPTION]; }; --------------------------------------------------------------------------- News File: news.fil --------------------------------------------------------------------------- Wanna dump something in the news? Here ya go. #define MAXNEWS 80 struct daily { char date[MAXSTANDARDINT+1]; //Stardate (game running date for delete) //game starts at 1 - see global.dat file //description for more details on date. char line[MAXNEWS+1]; //80 + 1 //news goes here. }; --------------------------------------------------------------------------- Mail File: mail.fil --------------------------------------------------------------------------- #define MAXNEWS 80 struct new_mail { char from_name[MAXNAME+1]; //from char to_name[MAXNAME+1]; //to char line[MAXNEWS+1]; //what they said. }; -------------------------------------------------------------------------- Global.dat file (Created by the install program sd_init.exe) (Stardate updated by first player on new day by spawned sd_ext.exe - maintenance program) -------------------------------------------------------------------------- struct global_file { char lifepoints[MAXSTANDARDLONG+1]; //new player lifepoints char lifepointsttl[MAXSTANDARDLONG+1]; //new player total lifepoints char credits[MAXSTANDARDLONG+1]; //new player credits char droids[MAXSTANDARDINT+1]; //new player droids char tipcnt[MAXSTANDARDINT+1]; //maximum stolen tips a day (turns) char wep_owner[MAXNAME+1]; //who currently owns weaponshop char arm_owner[MAXNAME+1]; //who currently owns armorshop char fights[MAXSTANDARDINT+1]; //fights per day char stardate[MAXSTANDARDINT+1]; //current stardate running //^use this if you create news! // this starts at one, and is // updated during each maintenance // run. Incremented by 1. unsigned char realdate; //Real d.day from _dos_getdate }; //I just check for a change. -------------------------------------------------------------------------- Exclusive File Access -------------------------------------------------------------------------- This is the exclusive file access routine used for the program: For those that haven't used exclusive file access: What this does is keeps two players from writing or reading a file at the same time. Big problems could develop on multi-line BBS's if players are playing at the same time, and writing the same file at the same moment. Bad Bad Bad!!! Author of the following exclusive file access function: Brian Pirie, Opendoors Door Programming Toolkit. <-get it, it's good! #define WAIT_FOR_FILE 10 /* Time to wait for access to file */ FILE *OpenExclusiveFile(char *pszFileName, char *pszAccess, time_t Wait); FILE *OpenExclusiveFile(char *pszFileName, char *pszAccess, time_t Wait) { FILE *pfFile; time_t StartTime = time(NULL); for(;;) { /* Attempt to open file */ pfFile = fopen(pszFileName, pszAccess); /* If file was opened successfuly, then exit */ if(pfFile != NULL) break; /* If open failed, but not due to access failure, then exit */ if(errno != EACCES) break; /* If maximum time has elapsed, then exit */ if(StartTime + Wait < time(NULL)) break; /* Give the OpenDoors kernel a chance to execute before trying again */ /////////NOTE/////////////////// od_kernel(); //should be included if you use Opendoors 5.0 } //or exclude it if you don't. /* Return pointer to file, if opened */ return(pfFile); } --------------------------------------------------------------------------- Enemies are hard coded in the game....ewwww. --------------------------------------------------------------------------- struct enemy { char name[MAXNAME+1]; //name of alien int living; //if alive = 1 char weapon[MAXWEAPONNAME+1]; //weapon name unsigned long weapon_energy; //weapon enemy int weapon_strength; //weapon strength int level; //level <-not used unsigned long experience; //experience int kills; //kills <-not used int weapon_status; //if they have a weapon = 1 <-not used char armor[MAXARMORNAME+1]; //armor name unsigned long armor_strength; //armor strength unsigned long credits; //credits long lifepoints; //yep long lifepointsttl; //uh-huh }; Well, there it all is. If you want some more info, write me e-mail at alanen@hvs.mail.com (Rock Garden BBS, Phoenix AZ) or at the Sherwood Forest BBS, (602) 876-0013. I'd be glad to look at what you have, or try to answer any pertinent questions. Hasta luego amigos. Estamos locos....(pardon my bad spanish) I'm a finlander that should be herding raindeer, not babbling in spanish and drinking irish cervezas... ---------------------------------------------------------------------------- More Help for Opendoors Hombres... ---------------------------------------------------------------------------- This is the main routine for the favrie colony. Also follows is a player file read for any module or main file. See also MODULE.C. void main(int argc,char *_argv[]) { int counter; int sync=0; for(counter=1;counter if(argc>1) strncpy(od_control.info_path,_argv[1],59); //path to door file od_init(); //opendoors initialization. strcpy(door_sys_name,od_control.user_name); //move user_name from door.sys door(); //to my door_sys_name. } } #define MAXBBSNAME 36 char door_sys_name[MAXBBSNAME+1]; void door(void) { char answer; r_player_file(); //get the player's normal stats. if(playerfound==1) { r_fahvrie_file(); //get the player's favrie stats. od_clr_scr(); //clear screen. od_printf("\n\rΥΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΈ\n\r"); od_printf("³`green`STARDOCK LOCO -`cyan` Rental Craft ³\n\r"); od_printf("ΤΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΎ\n\r"); od_printf("You get into the little short range Needler that you rented\n\r"); od_printf("from Guido and head over to the Favrie Colony. \n\r"); od_printf("\n\r <`red`L`cyan`> Land at the Favrie Colony\n\r"); od_printf(" <`red`X`cyan`> Exit back to Stardock\n\r"); od_printf("\n\rMake your choice: "); answer=od_get_answer("LX\n\r"); switch(answer) { case 'X': od_printf("\n\rScared of Deep Space, you decide to return to the Stardock."); WaitForEnter(); break; case 'L': default: favrie_main(); //main favrie screen and options menu. break; } } else { od_printf("\n\rPlayer not found!"); od_printf("Name Error."); WaitForEnter(); } //then will return from whence it came... } ////////////////////read of player file to get details/////////////// void r_player_file(void) { struct player *names; int p; FILE *fptr; record_count=0; if((names=(struct player*) calloc(100,sizeof(struct player)))==NULL) { od_printf("\n\rNot enough memory for Player.lst"); WaitForEnter(); } else { ///must have the exclusive file access.... fptr = OpenExclusiveFile("player.lst", "rb", WAIT_FOR_FILE); while( fread(&names[record_count],sizeof(names[record_count]),1,fptr)==1) record_count++; fclose(fptr); } //check for a match of name[p].bbs_name //against door_sys_name for(p=0;p