It is currently Thu Nov 20, 2008 12:46 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Newbie: Question about a script idea.
PostPosted: Fri Feb 03, 2006 10:09 am 
Offline

Joined: Thu Feb 02, 2006 8:44 am
Posts: 18
Location: Beaverton, OR, USA
Hello, my name is Aasan Dar. I'm going to start off by saying, I know absolutely nothing about scripting for POL. That being said, bear with me.

I'm wondering if there is a way (or a known script that does this) to auto-jail people who say things ingame that shouldn't be said (I don't believe I need to elaborate). I recently started developing a RunUO shard (I'm trying to broaden my horizons a bit and move to POL as well) and I found a script for it that does what I'm asking about. So I'm just curious if the concept is possible in POL and if so, is there a script out and about already or would somebody be willing to take on the project?

Thanks.

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 03, 2006 12:57 pm 
Hi there, and welcome...

The upcoming version of POL includes packet hooks, and you could hook the speech request packet, and parse it for such language, and do whatever in response, yes. (for example, you could use it to log all speech, implement a custom command system, or send people to jail if they use certain words, yes)

Just as a side note, with either RunUO or POL - I would be careful with such a system... you have to be sure your method allows the use of perfectly legitimate words which just happen to contain something else. For example, for a while there was an ongoing joke on my shard about shitake mushrooms.

I might suggest rather than sending them right to jail on use of certain words, if you really want to snag this stuff, maybe just log their entire sentence to a file, and send an alter to GMs with what they said... but that part is up to you, of course!


Top
  
 
 Post subject:
PostPosted: Fri Feb 03, 2006 2:41 pm 
Offline

Joined: Thu Feb 02, 2006 8:44 am
Posts: 18
Location: Beaverton, OR, USA
I understand. I had planned to make it so it search for just the word itself .. not with wildcards on the end.. (ex: "expletive" not *expletive*). The e-mail idea isn't bad though! Would probably work better. Well, I had wanted to wait until 096 anyway =) I was talking to MuadDib and he tells me good things. Well, thank you.

By the way, do you know of a POL script depository? Some place where people post POL scripts like on the (pardon the inappopriate reference) RunUO forum. I'm going to start learning to develop for a POL server and I'd like some examples...


Thanks.

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 03, 2006 3:14 pm 
Offline
POL Core Developer

Joined: Mon Jan 30, 2006 9:28 am
Posts: 292
Location: Germany, Bavaria
Marilla wrote:
The upcoming version of POL includes packet hooks, and you could hook the speech request packet, and parse it

And without Pol096 u can use an Item with a ControlScript and use inside RegisterForSpeechEvents to catch all speech in a specific range, analyze it and do what u want to do (e.g. jailing). Just place some of your Censor-Items in the World (e.g. inside towns).

OR

Attach such a control-script to Players-Backpack (e.g. within Logon-Script, just call your ControlScript via Start_Script). Btw: this way is a good way to log everything... ;o)

Shinigami


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 03, 2006 7:08 pm 
Offline

Joined: Thu Feb 02, 2006 8:44 am
Posts: 18
Location: Beaverton, OR, USA
Well, if any of that made any sense to me I'd certainly give it a shot! I shall look into it.

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 04, 2006 2:06 pm 
Offline
Certified POL Expert
User avatar

Joined: Thu Feb 02, 2006 1:41 pm
Posts: 1207
Location: Southern Central USA
Aasan Dar

I have a script that does something similar to what you want.

I do not know whom to credit with the writing of it but it's called Censor. I looked through the Distro scripts and couldn't find it. It is on our shard, Hope Lives, and what it does is turn the player to a slime of a random colour.

I will post all you need to implement it here as it's a small set of scripts.

First you'll need to create a package folder for it. I suggest in \pol\pkg\items

create a folder there called censor. Now paste the following into your text editor and save it as itemdesc.cfg in the above folder.


Code:
Item 0xA403
{
    Name        censor
    Desc        censor
    DecayTime   0
    ControlScript   censor
    graphic     0x1ea7
}


Now copy the following to your editoir and save it as censor.src in the same folder.



Code:
use os;
use uo;

include "include/eventid";

// To add to the list, just put new elements into the array.

var profanity :=
// insert here in quotes the "nasty words" you wish to monitor
// The list contained herein was modified for reason's of decency
// All except the last entry.
{
   "poop",
   "coitus",
   "donkeypit",
   "deitycondemn",
   "urine",
   "bigfemaleinsult",
   "Sigismund rules"
};

program censor(me)

   var x, i;

   RegisterForSpeechEvents(me, 50);
   EnableEvents(EVID_SPEECH,5);
   var ev;

   while (1)
           ev := os::wait_for_event( 5 );

           if (ev)
              case (ev.type)
            EVID_SPEECH:
               foreach x in profanity         
                         if (ev.text[x]);
                  DisableEvents(EVID_SPEECH);
                  i := ev.source;
                  start_script("punishment", i);
                  EnableEvents(EVID_SPEECH,5);
               endif
               endforeach
         endcase
      endif
   endwhile

endprogram


Now the punishment script that ac tually does the deed. Paste this and save it as punishment.src in the folder.

Code:
use uo;
use os;
use util;

program punishment(who)

   PrintTextAbove(who, "The gods do not tolerate such foolishness.");
   PlaySoundEffect(who, 0x002a);
   PlayLightningBoltEffect(who);
   who.graphic := 0x33;
   who.color := RandomInt(200) + 1;

endprogram


The first file that you made defined our device, the censor.

The first script, censor.src, is the "control" script. This script "lives" and is running for each censor you create. It does the necessary housekeeping to register the device for listening (speech events) and then executes the "punishement" script when it "hears" a bad word. Note the word list near the beginning. I edited all but the last entry for purposes of decency. You can figure out what the original words were I suppose.
*grins*
Oh yes and the last entry is the way I got the script so I think someone other than Sigismund must have written it.

The last script, punishment.src, changes the graphic to 0x33 which is a slime and then colours it a random colour. This script lacks the ability to change the character back however so the person stays that way until a GM can "fix" them. It should be fairly straightforward to edit the script to move the character to your jail location.

Hope this helps.

BTW welcome to the bestest mostest versatile UO emulator on the scene. I admit RunUO has a lot of momentum behind it but POL has the versatility and the long track record.

_________________
Sincerely,
Yukiko

I know you think you understand what you thought I said but what you heard is not exactly what I meant.

Titus 2:13


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 04, 2006 2:10 pm 
Offline
Certified POL Expert
User avatar

Joined: Thu Feb 02, 2006 1:41 pm
Posts: 1207
Location: Southern Central USA
I forgot about this file. You'll need it to enable the package. Save as pkg.cfg to the same folder with the other items.
Oh and by the way it seems that Sigismund did write this script. I excised it from his package called questtools.

Code:
Enabled 1
Name    Censor
Version 0.1
Maintainer Sigismund
Email prostheticdelirium@worldnet.att.net


Oh and don't forget to compile the above scripts.

_________________
Sincerely,
Yukiko

I know you think you understand what you thought I said but what you heard is not exactly what I meant.

Titus 2:13


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 04, 2006 5:07 pm 
Offline

Joined: Thu Feb 02, 2006 8:44 am
Posts: 18
Location: Beaverton, OR, USA
Thank you VERY much! That's perfect. I can figure out how to make it jail on my own I assume, but I'll pass it to my devs.

I compare RunUO to Microsoft Windows. It's a plug-n-play emulator with a lot of issues. It's good for people who don't know much to just get a shard up for people to play on.. but I've always liked POL better. =)

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 04, 2006 9:16 pm 
Offline
Certified POL Expert
User avatar

Joined: Thu Feb 02, 2006 1:41 pm
Posts: 1207
Location: Southern Central USA
Yes. I agree about RunUO. I halfway think there must be some money behind that team pushing them forward.

What I would love to see are some of the tools that have been developed for that emu created for POL. In particular the architect and land design proggies.

Anyway, POL 96 is right around the corner so when that is released it will be great.

_________________
Sincerely,
Yukiko

I know you think you understand what you thought I said but what you heard is not exactly what I meant.

Titus 2:13


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl