Top Mud Sites Forum Return to TopMudSites.com
Go Back   Top Mud Sites Forum > Mud Development and Administration > MUD Coding
Click here to Register

Reply
 
Thread Tools
Old 01-26-2003, 11:43 PM   #1
Verboden Faction
 
Posts: n/a
Running rom2.4, I have found the Change Ownership command on a few other muds, but I want to put it on mine, found some circle snippets, and having trouble converting it.  Anyone help?  -Those who don't know what the chown command does: it make an obj go from a player to an immortal no matter what.  I would type 'chown (obj) (player)' and that object would go from the player, whether it was equipped or not, and come to my inventory. If you have chown on your mud, just copy and paste the void do_chown section in your source file...
  Reply With Quote
Old 01-27-2003, 12:33 AM   #2
Verboden Faction
 
Posts: n/a
I got it to work. I had to rewrite the whole thing and make my own. but now i'm having a bit of an issue. It was kinda hard, but I got it. But here is my new problem, when you type 'chown (player)' but no object is put in, or the player doesn't have the object, the mud crashes. It's cause I don't have anything in the code for that instance. There is nothing for it to do if the object isn't found. What do I do to fix that?
  Reply With Quote
Old 01-27-2003, 02:25 AM   #3
Verboden Faction
 
Posts: n/a
...
  Reply With Quote
Old 01-27-2003, 03:32 AM   #4
Wenlin
Senior Member
 
Join Date: Apr 2002
Location: TopMudSites
Posts: 315
Wenlin is on a distinguished road
Send a message via AIM to Wenlin
Um, sir, I know nothing on the subject, but you're obviously awaiting a response...

Unfortunately, you're unlikely to get one in a few hours at the middle of the night. I hate to break it to you...
Wenlin is offline   Reply With Quote
Old 01-27-2003, 11:37 AM   #5
Terloch
Member
 
Join Date: Apr 2002
Location: Chicago, Illinois
Posts: 152
Terloch is on a distinguished road
Here's the syntax for our command which does probably the same thing as what you are trying to get to work...hope it helps...

DO_CMD ( do_seize )
{
char arg[MAX_INPUT_LENGTH];
CHAR_DATA * victim;
OBJ_DATA *obj;
OBJ_DATA *obj_next;
bool found;

argument = one_argument ( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char ( "{WSyntax:\n\r seize char <char> <object>{x\n\r", ch );
send_to_char ( " seize container <container> <object>{x\n\r", ch );
return;
}

if ( !str_prefix ( arg, "char" ) )
{
argument = one_argument ( argument, arg );
if ( arg[0] == '\0' )
{
do_function ( ch, &do_seize, "" );
return;
}

if ( ( victim = get_exact_player_room ( ch, arg ) ) == NULL )
{
send_to_char ( "They are not here.\n\r", ch );
return;
}

if ( IS_TRUSTED ( victim, LEVEL_ANCIENT ) )
{
send_to_char ( "Not on ancients.\n\r", ch );
return;
}

argument = one_argument ( argument, arg );
if ( arg[0] == '\0' )
{
do_function ( ch, &do_seize, "" );
return;
}

found = FALSE;
for ( obj = victim->carrying; obj != NULL; obj = obj_next )
{
obj_next = obj->next_content;

if ( is_name ( arg, obj->name ) )
{
found = TRUE;
obj_from_char ( obj );
obj_to_char ( obj, ch );
send_to_char ( "Ok.\n\r", ch );
ACT_OC ( "{WYou couldn't tell how it happened, but $p is now in $r's possesion.{x",
ch, obj, victim, TO_VICT );
}
}

if ( !found )
{
send_to_char ( "No such item found.", ch );
}
}

else if ( !str_prefix ( arg, "container" ) )
{
send_to_char ( "Not implemented.\n\r", ch );
}

else
{
do_function ( ch, &do_seize, "" );
}

return;
}

Terloch
Terloch is offline   Reply With Quote
Old 01-28-2003, 02:57 AM   #6
markizs
Member
 
Join Date: Jan 2003
Location: Riga, Latvia
Posts: 36
markizs is on a distinguished road
Send a message via ICQ to markizs
hmm. as i am keen only with lp muds and dont see where your problem is :P in lpmud that would look somthing like:

init()
{
add_action("chown","chown");
}

int chown(string str)
{
string s1,s2;
if (str)
{
scanf(str,%s %s,s1,s2);
if (!s1 || !s2) return 0;
move_object(find_object(s1),find_player(s2));
return 1;
}
return 0;
}

//just wanted to post somthing :PPP
//shame that all talks there are about anything but lpmud :(
markizs is offline   Reply With Quote
Old 01-28-2003, 04:22 AM   #7
Ogma
Member
 
Ogma's Avatar
 
Join Date: Apr 2002
Home MUD: DartMUD
Posts: 86
Ogma is on a distinguished road
Actually, you're going to want to use

if (str && str!="" && sscanf("%s %s",s1,s2)==2) ...

and you probably want to check if the two find_player calls actually worked.

And yes, LPMUDs are far outnumbered by the bland Diku/Merc/Rom/Smaug crowd.
Ogma is offline   Reply With Quote
Old 01-28-2003, 05:04 AM   #8
markizs
Member
 
Join Date: Jan 2003
Location: Riga, Latvia
Posts: 36
markizs is on a distinguished road
Send a message via ICQ to markizs
heh. yes you proved me wrong. just havnt coded such stuff for few months and slightly forgot the syntax :)
but i rem doing somthing like that with find_object and find_player. using other stuff too, but i wernt sure if that wasnt mudlib functions, or maybe our modified amylaars stuff. oh well. my listing was still 10 times shorter than one above :)
markizs is offline   Reply With Quote
Old 01-28-2003, 07:39 AM   #9
jornel
Member
 
Join Date: Sep 2002
Location: Canada
Posts: 73
jornel is on a distinguished road
Verboden Faction,

Perhaps it would help if you posted a copy of the code you wrote where we could look at it and help you find what's wrong or missing?
jornel is offline   Reply With Quote
Old 03-23-2003, 07:12 PM   #10
Verboden Faction
 
Posts: n/a
Actually, I figured it out. I run on rom24b6, here is what I used.

[code] void do_chown(CHAR_DATA *ch, char *argument)
{
CHAR_DATA *victim;
OBJ_DATA *obj;
char arg1[MIL];
char buf[MSL];
buf[0] = '\0';
bool found = FALSE;



argument = one_argument(argument,arg1);

if(IS_NULLSTR(arg1)){
send_to_char("chown <player> <item>\n\r", ch);
return;
}

if((victim = get_char_room(ch,arg1)) == NULL){
send_to_char("There is no such person.\n\r", ch);
return;
}

for(obj = victim->carrying; obj; obj = obj->next_content ){
if ( is_name( argument, obj->name )
&& can_see_obj( ch, obj ))
{
found = TRUE;
break;
}
}

if(!found){
send_to_char("They don't have that.\n\r", ch);
return;
}



obj_from_char( obj );
obj_to_char( obj, ch );
sprintf(buf, "You summon %s from %s.\n\r", obj->short_descr, victim->name);
send_to_char(buf, ch);
sprintf(buf,"You feel a light wind as %s floats into the hands of %s.\n\r",obj->short_descr,ch->name);
send_to_char(buf, victim);
return;
}
[/quote]
  Reply With Quote
Reply


Thread Tools


Chown Command - Similar Threads
Thread Thread Starter Forum Replies Last Post
Features of a MUD command parser. Drealoth Advanced MUD Concepts 15 04-27-2006 02:08 PM
command processor Dubthach MUD Coding 4 10-26-2004 11:01 PM
Jog Command Jaegar MUD Coding 4 04-09-2004 04:41 AM
Switch command Verboden Faction MUD Coding 8 05-15-2003 09:31 PM
Command trigger for progs Jaegar MUD Coding 1 04-03-2003 06:41 PM

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

All times are GMT -4. The time now is 11:15 AM.


Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Style based on a design by Essilor
Copyright Top Mud Sites.com 2022