19 Jan, 2009, Venrexx wrote in the 1st comment:
Votes: 0
Here is another code I have always thought about adding to save alot of work and time for immortals and to save alot of space in logs and such. How would one go about setting in code so that when someone PK's in an area that is non pk (or not marked as pk) they get automatically helled for a certain period of time (lets say 2 or 3 hours as an example). SMAUG Codebase 1.4a.
19 Jan, 2009, ghasatta wrote in the 2nd comment:
Votes: 0
Wouldn't it just be easier to disallow that from happening in the first place?
19 Jan, 2009, Venrexx wrote in the 3rd comment:
Votes: 0
I like a little discipline, I allow people to PK anywhere so they can take out their anger on someone when they REALLY need to but they also know the punishment if done in a non-pk area. Plus the way my code is currently set up, every character that is created is a HardCore character so they can PK anywhere, I think it would just be easier and better if I were to add in a code that hells them when they Pk in a non PK area and then I add in help files and such explaining this.
19 Jan, 2009, Zeno wrote in the 4th comment:
Votes: 0
Where str is string = target + amount;

do_hell(NULL, str);


Dunno if you can use NULL though.
19 Jan, 2009, Venrexx wrote in the 5th comment:
Votes: 0
I am completely lost, where would I add that or define it as a non pk only thing lol I ask this because I have never before done ANYTHING regarding coding for PK so I have no idea where to do what lol
I already have a hell command but I want the game to auto hell them without an imm needing to do it if they pk in a non pk area
19 Jan, 2009, Zeno wrote in the 6th comment:
Votes: 0
Erm.

Look into basic programming: function calls.
19 Jan, 2009, Venrexx wrote in the 7th comment:
Votes: 0
I tried that, I got nowhere, that is why I am now asking here.
I need an function call to do_hell for non pk in do_pk but I am unsure of how to start the ifcheck as I do not know how to define the nonpk rooms or if that even already exists.
20 Jan, 2009, Venrexx wrote in the 8th comment:
Votes: 0
So far all I have for the ifcheck is:
do_hell(ch, argument );

I don't know how to add 2 hours onto that as the argument, everything I have tried pulled up errors, if I had hair I would be pulling it out right about now.
20 Jan, 2009, Kline wrote in the 9th comment:
Votes: 0
If you were to type "hell" in game, the argument would be whatever follows it, ie, "hell <xyz>" and <xyz> is the argument. Now, knowing this, prior to the do_hell() call there you should be able to sprintf(argument,"stuff you want the command to do here");
20 Jan, 2009, Venrexx wrote in the 10th comment:
Votes: 0
sprintf(argument, "2 hours");
do_hell(ch, argument );

did that and I get the following errors:
fight.c: In function 'check_illegal_pk':

fight.c:6353: error: 'argument' undeclared (first use in this function)
fight.c:6353: error: (Each undeclared identifier is reported only once
fight.c:6353: error: for each function it appears in.)
make[1]: *** [fight.o] Error 1
make[1]: Leaving directory `/home/Venrexx/dbfl/src'
20 Jan, 2009, Zeno wrote in the 11th comment:
Votes: 0
20 Jan, 2009, David Haley wrote in the 12th comment:
Votes: 0
Please don't take this the wrong way, but it looks like you should step back a little bit and try some very simple things in C without trying to touch the MUD code. That will help you get better at all of this in a simpler context. You're running into some pretty basic problems, and the best way to not get them in the future is to learn about general programming a bit.
20 Jan, 2009, Venrexx wrote in the 13th comment:
Votes: 0
Like I have been trying to tell zeno and others many many times… I was born with somewhat of a learning cap. If I cannot see how it applies to my general purpose or explanations as to why things have to be the way they have to be then I will never learn it no matter how hard or how long I try. The only way in anything, through school, through work or anywhere else for me to learn something and then be able to apply it in the future was people showing me how to do it so that I may understand where I went wrong, why I went wrong and possibly learn how to apply it in the future. It is annoying for most but it is more annoying for me I can assure you all of that much. But yes, I have read the tutorials and help books and this is the stage I am at, I have learned about as much as I can and it does not help me here at all. So far the help that I have gotten (eg; someone gives the code and explains the parts and why they are there and what they do) have also helped me to apply them elsewhere and have negatised alot of issues, it's how I learn… I don't even know what that kind of learning style is called…
20 Jan, 2009, The_Fury wrote in the 14th comment:
Votes: 0
Venrexx said:
Like I have been trying to tell zeno and others many many times… I was born with somewhat of a learning cap. If I cannot see how it applies to my general purpose or explanations as to why things have to be the way they have to be then I will never learn it no matter how hard or how long I try. The only way in anything, through school, through work or anywhere else for me to learn something and then be able to apply it in the future was people showing me how to do it so that I may understand where I went wrong, why I went wrong and possibly learn how to apply it in the future. It is annoying for most but it is more annoying for me I can assure you all of that much. But yes, I have read the tutorials and help books and this is the stage I am at, I have learned about as much as I can and it does not help me here at all. So far the help that I have gotten (eg; someone gives the code and explains the parts and why they are there and what they do) have also helped me to apply them elsewhere and have negatised alot of issues, it's how I learn… I don't even know what that kind of learning style is called…


As for where to put it, take a look at the place that sends the dialog to immortals when an illegal pk occurs, as got how to add a call to to that function you might want to look at all the called to do_look( ch, "auto"); as this specific example is doing something very much like what you want to do.

Like you, generic examples did nothing for me when i started out, i needed practical examples of real code in real world situations, with that in mind, i reccommend using an IDE to program in that has syntax highlighting and checking, and to learn how to use GREP. Just about everything you need answers for is right under your fingers, you just have to learn how to find the answers to your questions. Your codebase has literally 1000's of examples in it of many things you want to do and by using some basic grep and a few other console commands like more and the pipe | and you can uncover those examples you need.
20 Jan, 2009, Venrexx wrote in the 15th comment:
Votes: 0
So in other words…
do_hell(ch, "2 hours");

should work as it is telling it to hell for 2 hours…
20 Jan, 2009, Zeno wrote in the 16th comment:
Votes: 0
No. Read this again:
Kline said:
If you were to type "hell" in game, the argument would be whatever follows it, ie, "hell <xyz>" and <xyz> is the argument. Now, knowing this, prior to the do_hell() call there you should be able to sprintf(argument,"stuff you want the command to do here");


Unless you think typing "hell 2 hours" works?
20 Jan, 2009, Sharmair wrote in the 17th comment:
Votes: 0
It looks like check_illegal_pk() has a couple buffers you could use (buf and buf2). But you
will need the victim name in the argument you pass to do_hell, so you might want to set
up the argument with something like:
sprintf(buf, "%s 2 hours", ch->name);

Then call do_hell like:
do_hell(ch, buf);

Note that the victim of the hell is the ch of the check_illegal_pk function.
A quick look at do_hell seems to indicate that you can use it to in effect hell your self
(calling it with ch in this case) though some of the messages might be a bit odd (like
the victim will get a message about when they will be released from hell in the 3rd
person). You could modify do_hell to take a NULL CHAR_DATA* but you would have
to take into account all the uses of ch in the function.
20 Jan, 2009, Davion wrote in the 18th comment:
Votes: 0
I think a much better approach would be to make a new function that does exactly what do_hell does (probably just moves a player and sets some form of timer), call it, auto_hell() that accepts a victim. This way, you don't have to waist cycles chopping up a string, then looking for the player.
20 Jan, 2009, Venrexx wrote in the 19th comment:
Votes: 0
I just found out somehow I lost the roomflag called "nopk", this flag allowed pk but informed the system that it was illegal. The reason being for all this is the only other flags are area flags and they are either nopkill or freekill and they both either allow no pkill in the entire area and take the ability to kill away or allow you to pkill anywhere. I want to be able to set rooms themselves so only some rooms in an area are pk and others are not and if you pkill in a non marked room you get helled. Last night I tried re-adding the nopk flags but it didn't work. I just caused the usual errors as I have never added room flags before. Lately I have been feeling like such an idiot >.<
20 Jan, 2009, David Haley wrote in the 20th comment:
Votes: 0
It would help if you described:
1- what you changed
2- what the "usual errors" are
0.0/35