Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ Running the server ➜ SWR

SWR

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Shadoan   Canada  (21 posts)  Bio
Date Tue 10 Apr 2001 03:23 PM (UTC)

Amended on Tue 10 Apr 2001 09:50 PM (UTC) by Nick Gammon

Message
Hrm ok well I got SWR 1.0 working, fixed the score bug added tractorbeams and openbay/closebay and edited the who list and wizlist colors, YAY for me :P
Well NOW I'm trying to install a ship hailing code, so:
Ship1 hails Ship2: Hello.
Ship2 hails Ship1: Hi, how are you.
But when I try hailing inside the game i get both the:
You sent: Hello
Ship1 sent: Hello
Dunno whats wrong, I'm gonna post the Hailing code right here:


#include <stdio.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include "mud.h"

void do_hale( CHAR_DATA *ch, char *argument )
{
   
   SHIP_DATA *ship;
   SHIP_DATA *ship2 = ship_from_cockpit( ch->in_room->vnum );
   int  count;
   int top_num=15;
   int vnum[top_num];
   DESCRIPTOR_DATA *i;
   CHAR_DATA *och;
   char buf[MAX_STRING_LENGTH];
   char buf1[MAX_STRING_LENGTH];
   char arg1[MAX_INPUT_LENGTH];
   char arg2[MAX_INPUT_LENGTH];
   argument = one_argument( argument, arg1 );
   strcpy(arg2,argument);
   if (arg1[0] == '\0' || arg2[0] == '\0')
   {
   	send_to_char ("Syntax: Hail <ship> <message>\n\r", ch);
   	return;
   }
   
   ship = get_ship( arg1 );
   send_to_char ("\n\r", ch);
   if (!ship)
   {
     send_to_char ("No Such Ship!\n\r", ch);
     return;
   }
   if (!ship2)
   {
   	send_to_char("But your not in a cockpit!\n\r", ch);
   	return;
   }
   sprintf (buf, "&R(&BHAIL&R) &G&W%s sent: %s\n\r", ship2->name, arg2);
   sprintf (buf1, "&R(&BHAIL&R) &G&WYou Send: %s\n\r", arg2);
   send_to_char(buf1, ch);
   sprintf (buf1, "&g%s adjusts some settings on the comm system and says something", ch->name, arg2);
   act( AT_GREEN, buf1,  ch, NULL, NULL, TO_NOTVICT );
   vnum[0] = ship->cockpit;
   vnum[1] = ship->pilotseat;
   vnum[2] = ship->gunseat;
   vnum[3] = ship->coseat;
   vnum[4] = ship->navseat;
   vnum[5] = ship->turret1;
   vnum[6] = ship->turret2;
   
 for (i = first_descriptor; i; i = i->next)
  {
    if (!i->connected && i->character)
    {
      och = i->original ? i->original : i->character;	
    }
   for( count=1; count <= top_num; count = count + 1 )
   {
     if (och->in_room->vnum == vnum[count])
     {
     	send_to_char(buf, och);
     	break;
     }
   }
  }
}

Edge of Darkness MUD and Hosting Service,
Head Administrator(Retired)
All your SWR needs, right here, right now.
Top

Posted by Shadoan   Canada  (21 posts)  Bio
Date Reply #1 on Tue 10 Apr 2001 03:25 PM (UTC)
Message
Oh and the do_hale in the beginning IS suppose dto be spelled hale NOT hail.

Edge of Darkness MUD and Hosting Service,
Head Administrator(Retired)
All your SWR needs, right here, right now.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #2 on Tue 10 Apr 2001 10:05 PM (UTC)
Message
Well, I can see a few problems.



1. You have defined:


int top_num=15;


However you only set up 7 of them:


vnum[0] = ship->cockpit;
vnum[1] = ship->pilotseat;
vnum[2] = ship->gunseat;
vnum[3] = ship->coseat;
vnum[4] = ship->navseat;
vnum[5] = ship->turret1;
vnum[6] = ship->turret2;


That means that in your loop where you send to vnum index 1 to 15, some of them will be undefined, and might be your own vnum.




2. Your loop here is wrong:


for( count=1; count <= top_num; count = count + 1 )


This will send vnum [1] through to vnum [15], however you have only defined 15 of them, so it should be sending from vnum [0] to vnum [14].

So, it should read:


for( count=0; count < top_num; count++)


Saying "count++" is a short-hand way of adding 1 to count, although what you did will work.




3. I would check you aren't sending to yourself, which - all else being OK - would result in the messages you saw. eg.



   if (ship == ship2)
   {
     send_to_char ("You can't hail yourself!\n\r", ch);
     return;
   }


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Shadoan   Canada  (21 posts)  Bio
Date Reply #3 on Tue 10 Apr 2001 10:57 PM (UTC)
Message
Cool it worx, thx, it wasn't my code btw a friend found it somewhere and sent it to me, I just edited some of it to make it look nicer(2 lines of it to be exact) :). Ok I don't know if you know much about the SWR codebase but I wanted to be able to make MOB ships into squadron and command all of the squadron from inside a deifferent ship. Don't know how that will work.
Oh and I found anice snippet which is SUPPOSED to make flight simulators work on SWR but it was buggy, if you have time can ya look at it? Just tell me if ya want me to post it.
Ok I'll stop flooding you with questions....for now:)

Edge of Darkness MUD and Hosting Service,
Head Administrator(Retired)
All your SWR needs, right here, right now.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #4 on Wed 11 Apr 2001 04:22 AM (UTC)
Message
I don't have a huge amount of free time myself just now, as I am about to start on a new version of MUSHclient with all the extra features people have been asking for.

You can always post the message here in the hope that someone else will answer it. :)

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by OmegaRatio   (1 post)  Bio
Date Reply #5 on Fri 13 Jul 2001 05:46 PM (UTC)
Message
I come here out of lack of no where else to go. I have Windows 98 and I have recently been running SmaugWizard which allows me to run a smaug server for windows(perhaps you've heard about it). Originally it was to help me learn to build for SWR, which was my real passion, and today I found a similar program that runs SWR called StarWarsSmaug. It came with no documentation so I improvised. I downloaded some smaug source and tried placing it in the directory and running it. It didnt work. Then I downloaded the SWR source and tried it. It seemed to work but every time I tried to do something else, like open a mud client, it restarted my computer. I come to you asking if you know where I could find some documentation on the subject, or whether you can help fix my problem with the mysterious restartings.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #6 on Sat 14 Jul 2001 12:28 AM (UTC)
Message
Putting source in the directory won't do much, it needs to be compiled.

I did an executable version of SWR SMAUG which is available from the downloads area, above, it is intended to be loaded on top of a standard SMAUG download (also available from the same place).

It shouldn't restart the PC, unless there is a program bug.

I don't know of any documentation, I did the conversion for someone, but they didn't supply a huge amount of documentation about how to use it, so I don't really know.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


18,548 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.