PenUltima Online

It is currently Sat Aug 30, 2008 4:20 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: Couple questions about creating new characters
PostPosted: Thu Mar 01, 2007 12:18 pm 
Offline
User avatar

Joined: Tue Sep 19, 2006 6:27 am
Posts: 58
Is it possible to remove the Advanced option on the class selection menu? It's not in the prof file ...

Also... how do I restrict how many characters are allowed per account?

Thanks.

_________________
"Don't open that! We're on an alien planet! Is there air!? You don't know!!"


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 02, 2007 12:50 am 
Offline

Joined: Thu Feb 02, 2006 1:41 pm
Posts: 1120
Location: Southern Central USA
This might be what you need to limit characters.

In \pol\scripts\misc in oncreate.src after the following code:
Code:
    syslog("ALERT! Account " + account.name + " was banned for cheating.");
  endif


add this:

Code:
  var maxchars := 5; // Maximum allowed characters.
  var numchars := 0; // Counter for use later
    for i := 1 to 5
        var chr := account.GetCharacter(i);
        if (!chr)
            continue;
        else
            numchars := numchars + 1;
        endif
    endfor
   
    if (numchars > maxchars)
        who.paralyzed :=1;
        SendSysMessage(who, "You have exceeded the maximum allowable characters!!!", 2, 33);
        SendSysMessage(who, "In 30 seconds this character will be deleted.", 2, 33);
        Sleep(30);
        DisconnectClient( victim );
        account.DeleteCharacter( i );
    endif


The only caveat is that the character must be in a safe logout (insta log) location when she enters the world for the account.DeleteCharacter to operate correctly. If she is in a delayed logout condition then the account.DeleteCharacter doesn't work or atleast it didn't in POL 95.

I think that scriptlet will work.

NOTE: This is is compatible with a converted POL 0.95 scripset only.

_________________
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: Fri Mar 02, 2007 2:58 am 
I hope anyone who uses that script as written is ready for some big-time nightmares.

Let's first assume that characters won't be created in a "insta-log" area. But even if we don't assume that, the script there gives the character plenty of time to run to such a place. Most people completely ignore login messages, so I guarantee they'll usually miss that message, and go running off to play, and find themselves kicked off for reasons they don't understand.

Maybe, after it happens a couple times, they'll realize why. They'll be confused about why their character isn't actually being deleted, though. So, maybe they'll log in one of their real characters to check it. They'll see that SAME MESSAGE. And they won't know this... but if they don't run that character RIGHT AWAY away from a zero-timeout location, it will be THAT character that will be deleted.

*sigh*


First problem: They should be logged off immediately when this happens... not have it wait 30 seconds. Put in a sleep of a second to assure they get the message. Better yet, make the message a GUMP, so they can't miss it. But then kick them out immediately, and MARK THE CHARACTER with a CProp to note that it must be deleted. The 30-second sleep is a decent idea - but AFTER kicking them off and marking them with a CProp. Not before.

When counting characters in this script, then, you must also check for this CProp, and ONLY count characters that don't have this CProp. If anyone ever logs in a char with this CProp, just kick and delete, without even bothering counting. Otherwise, count ONLY those without the CProp, and...

Finally, after you kick them off, for heaven's sake, don't leave things up to chance!!! Move their character to a zero-timeout location first!


Whoever wrote the above script needs some logic lessons before any more scripting lessons, I think. :oops:


Top
  
 
 Post subject:
PostPosted: Fri Mar 02, 2007 5:08 am 
Offline
User avatar

Joined: Tue Sep 19, 2006 6:27 am
Posts: 58
barb,

Now I could be wrong here but I believe the "who.paralyzed :=1; " part means the character is now paralyzed and cannot "go running off to play".

Besides, anyone who goes running off to play on my shard gets killed instantly ... it's part of the magic.

Anyway this script looks good to me and if nothing more gives me something to work with.

Thanks Yukiko

_________________
"Don't open that! We're on an alien planet! Is there air!? You don't know!!"


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 02, 2007 12:15 pm 
Datus wrote:
barb,

Now I could be wrong here but I believe the "who.paralyzed :=1; " part means the character is now paralyzed and cannot "go running off to play".


Granted. But maybe read beyond the first sentence or two, mkay? Or have fun dealing with players who get their 7xGM character deleted because of the above script.


Top
  
 
 Post subject:
PostPosted: Fri Mar 02, 2007 6:21 pm 
Offline
User avatar

Joined: Tue Sep 19, 2006 6:27 am
Posts: 58
Ok I'm convinced now that Barbeirosa is a joke... so I'm going to ignore him... unless he does a really amazing trick ... like actually post his own code.

_________________
"Don't open that! We're on an alien planet! Is there air!? You don't know!!"


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 02, 2007 11:28 pm 
This is the only time I will do this, and only to prove you wrong. I told you how to do it, it should have been a simple matter to figure out. But here it is. Next time, I'm sure you'll be able to figure it out yourself.

Code:
var account := who.acct;
var INVALID_CHAR_CPROP := "INVALID_CHARACTER";
var maxchars := 5;
var numchars := 0;
var myindex := 0;
if (GetObjProperty(who, INVALID_CHAR_CPROP))
   numchars := maxchars + 1;
endif
var i;
for (i:=1;i<=5;i:=i+1)
   var chr := account.GetCharacter(i);
   if (chr)
      if (!GetObjProperty(chr, INVALID_CHAR_CPROP))
         numchars := numchars + 1;
      endif
      if (chr==who)
         myindex := i;
      endif
   endif
endfor

if (numchars > maxchars && myindex)
   who.paralyzed :=1;
   SendSysMessage(who, "You have exceeded the maximum allowable characters ("+cstr(maxchars)+") This character will be deleted.", FONT_BOLD, FONTCOLOR_RED);
   Sleep(1);
   SetObjProperty(who, INVALID_CHAR_CPROP, 1);

   var x, y, z; //set x, y, z to a closed 'insta-log' location

   MoveCharacterToLocation(who, x, y, z, MOVECHAR_FORCELOCATION);   
   DisconnectClient(who);
   sleep(30);
   account.DeleteCharacter(myindex);
endif


If there are any typos in the code, feel free to ask about them. I did not bother mentioning the typos in the code I fixed that would have resulted in other errors (like, always deleting the 5th character, no matter which character was actually the one logged on)


Top
  
 
 Post subject:
PostPosted: Sat Mar 03, 2007 6:50 pm 
Offline
User avatar

Joined: Tue Sep 19, 2006 6:27 am
Posts: 58
that's pretty crappy barbie...

you just copied 90% of what yukiko already wrote... and you can prove me wrong by not being a weenie.

_________________
"Don't open that! We're on an alien planet! Is there air!? You don't know!!"


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 03, 2007 11:26 pm 
Datus wrote:
that's pretty crappy barbie...

you just copied 90% of what yukiko already wrote...


Except I fixed the numerous errors which would have had your players pretty pissed. Crappy? Fine. I already said I won't do it again. Next time, just use whatever you find!


Top
  
 
 Post subject:
PostPosted: Sun Mar 04, 2007 10:01 pm 
Offline

Joined: Thu Feb 02, 2006 1:41 pm
Posts: 1120
Location: Southern Central USA
A couple of things:

1. I made that post as my lappy battery was getting low so I was afraid I'd lose power and didn't have time to script a gump call. Hence the message being in RED and being set to font 2, an expanded larger font than the default font.

2. I mentioned the caveat about needing an insta log location for character creation because I assumed that most shard owners chose the location the character enters the world. If they don't know how to do that then please ask and I am sure Barbarosa can explain it to them.

Barbarosa wrote:
Quote:
Better yet, make the message a GUMP, so they can't miss it. But then kick them out immediately...

3. Wouldn't kicking the player immediately after sending a gump disconnect them and therefore prevent them from seeing it? I haven't checked that out yet but it might not give the desired result.

I do agree that a non closable gump would be the ideal way of informing the player but as I said I was up against the clock that night. By the way I did miss seeing that gump code in your "new and improved" version of my scriptlet Barbie.

As for any other criticisms of my code...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 05, 2007 12:18 am 
Yukiko wrote:
3. Wouldn't kicking the player immediately after sending a gump disconnect them and therefore prevent them from seeing it? I haven't checked that out yet but it might not give the desired result.


Yes it would, which is why I put in a one-second sleep after.

Your code gave a great basic idea how to do what was asked but the problem is a lot of the time people just cut and paste exactly what is posted without ever looking at it. Your original post almost seemed to suggest doing exactly that. But as far as offering help for the general idea it was great and as dattie said I basically copied it for my own post.


As for the other topic in this thread; you can't really remove the advanced option but you can sort of hide it. Just add more entries to the prof.txt file to push the advanced option out of the way. 6 entries pushes it down. The result is not pretty but it may work for you.


Top
  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 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