Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-17-2009, 06:59 AM
[email protected] jamerson61894@yahoo.com is offline
Banned
Join Date: Jul 2008
Posts: 83
jamerson61894@yahoo.com is an unknown quantity at this point
script help

Hello, i have a script. it basically makes the npc server reset someones attributes if they havnt been reset.

function onCreated()
{
this.resetver = 1;
}

function onActionPlayerOnline()
{
temp.rplayers.loadvars("resetlog.txt");

if (makevar("temp.rplayers.acct_" @ player.account) < this.resetver)
{
sendtorc(format("/reset %s", player.account));

makevar("temp.rplayers.acct_" @ player.account) = this.resetver;
temp.rplayers.savevars("resetlog.txt", 0);
return false;
}




It isnt working though

someone help me fix it please.

Last edited by [email protected]; 01-17-2009 at 07:11 AM..
Reply With Quote
  #2  
Old 01-17-2009, 07:15 AM
salesman salesman is offline
Finger lickin' good.
salesman's Avatar
Join Date: Nov 2008
Location: Colorado
Posts: 1,865
salesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud of
this might help you

http://forums.graalonline.com/forums...ad.php?t=77689
Reply With Quote
  #3  
Old 01-17-2009, 07:15 AM
Seich Seich is offline
Noctorious' NeoHunter
Seich's Avatar
Join Date: Jun 2008
Location: Honduras
Posts: 193
Seich will become famous soon enough
Send a message via MSN to Seich Send a message via Yahoo to Seich
If you want to reset players as they login use something like this:

PHP Code:
function onActionPlayerOnline(){
    if(
client.reset != true){
        
temp.acc player.account;
        
sendtorc(format("/reset %s"temp.acc));
        
client.reset true;
    }

This should be added to the npc control.

I personally dislike that method, I would reset all accounts for once, instead of resetting them as players login as you requested.
Reply With Quote
  #4  
Old 01-17-2009, 07:36 AM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Quote:
Originally Posted by Seich View Post
PHP Code:
function onActionPlayerOnline(){
    if(
client.reset != true){
        
temp.acc player.account;
        
sendtorc(format("/reset s"temp.acc));
        
client.reset true;
    }

You shouldn't use client. variables for things like a reset since client. variables can be edited with a memory editor. You should use a clientr. variables and there's no need to use a temp variable you could just do sendtorc("/reset" SPC player.account);.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #5  
Old 01-17-2009, 07:44 AM
[email protected] jamerson61894@yahoo.com is offline
Banned
Join Date: Jul 2008
Posts: 83
jamerson61894@yahoo.com is an unknown quantity at this point
Is there a script that resets all accounts at once? I would prefere that.

please tell me seich =]
Reply With Quote
  #6  
Old 01-17-2009, 07:46 AM
[email protected] jamerson61894@yahoo.com is offline
Banned
Join Date: Jul 2008
Posts: 83
jamerson61894@yahoo.com is an unknown quantity at this point
I personally dislike that method, I would reset all accounts for once, instead of resetting them as players login as you requested.

How could I do that? You know, resetting every player at once?

Please explain to me.
Reply With Quote
  #7  
Old 01-17-2009, 07:51 AM
[email protected] jamerson61894@yahoo.com is offline
Banned
Join Date: Jul 2008
Posts: 83
jamerson61894@yahoo.com is an unknown quantity at this point
if (playerenters) {
sendtorc("/reset" SPC player.account);
}


Ok, that works, but it doesn't do it only once, It continues to reset. How do I stop this?
Reply With Quote
  #8  
Old 01-17-2009, 07:54 AM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Quote:
Originally Posted by [email protected] View Post
if (playerenters) {
sendtorc("/reset" SPC player.account);
}


Ok, that works, but it doesn't do it only once, It continues to reset. How do I stop this?
PHP Code:
function onActionPlayerOnline() {
  if (!(
player.account in this.reset)) {
    
this.reset.add(player.account);
    
sendtorc("/reset" SPC player.account);
  }

Put it in the DB NPC called Control-NPC.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #9  
Old 01-17-2009, 08:01 AM
[email protected] jamerson61894@yahoo.com is offline
Banned
Join Date: Jul 2008
Posts: 83
jamerson61894@yahoo.com is an unknown quantity at this point
Tig, you seem to have a good knowledge of scripting. Is there a script that when I update the npc server, it resets every account in the whole game? Like and it wont have to wait for them to log on and disconnect them?
Reply With Quote
  #10  
Old 01-17-2009, 08:05 AM
Matt Matt is offline
iZone Administrator
Matt's Avatar
Join Date: Apr 2005
Location: United States
Posts: 2,690
Matt is a jewel in the roughMatt is a jewel in the rough
I don't think that's possible. The closest thing you'll get, which should be good enough is that once that script that Tig gave you is in the Control-NPC, you can right click on that and select 'Reset'. That should make it so every play that logs in again will have their account reset automatically their next login onto your playerworld.
__________________
Need Playerworld or Account support?
GraalOnline/Toonslab Support Center
Reply With Quote
  #11  
Old 01-17-2009, 08:49 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
I know Stefan has a handy serveroption for it but there is no way for a developer to do it. Unless you deleted all the account folders but there would probably be repercussions to that
Reply With Quote
  #12  
Old 01-17-2009, 08:57 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
The account folders/files also store staff data on them(like rights, IP/PCID access yada yada). I don't think there would be a direct repercussion if you delete all files other than staff, but giving the NPC server RW rights to account folders is risky, though not too risky if you remove the rights as soon as you're done.
Reply With Quote
  #13  
Old 01-17-2009, 09:18 AM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
As Dusty said above, you could delete the files in the accounts folder. I have done this before, but I haven't tested it multiple times, so I'm not sure if it's still working. If you give the NPC-Server rights to the accounts/ folder temporarily you could use a script to scan & delete the accounts folder. Also restart the GServer & NPC-Server once you're done for changes to take full effect. Your rights & everything will be gone though, so make sure the server owner is present to re-add your rights. This method is also highly unrecommended unless you have a great knowledge of what you're doing.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #14  
Old 01-17-2009, 03:56 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
PHP Code:
function resetAll() {
  
temp.folder.loadFolder("accounts/*"true);
  
  for (
temp.file folder) {
    if (!
file.ends(".txt")) {
      continue;
    }
    
    
file file.substring(0file.length() - 4); // remove extension
    
temp.tokens file.tokenize("/"); // split between slashes
    
    
sendtorc("/reset" SPC tokens[tokens.size()]);
  }

I imagine something like this would work, but I've never tried anything like it. No rights should be needed; loadFolder works with no read rights as far as I know.
__________________
Reply With Quote
  #15  
Old 01-17-2009, 10:53 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by cbk1994 View Post
PHP Code:
function resetAll() {
  
temp.folder.loadFolder("accounts/*"true);
  
  for (
temp.file folder) {
    if (!
file.ends(".txt")) {
      continue;
    }
    
    
file file.substring(0file.length() - 4); // remove extension
    
temp.tokens file.tokenize("/"); // split between slashes
    
    
sendtorc("/reset" SPC tokens[tokens.size()]);
  }

I imagine something like this would work, but I've never tried anything like it. No rights should be needed; loadFolder works with no read rights as far as I know.
As far as I know, a player has to be online to be reset.
Reply With Quote
  #16  
Old 01-18-2009, 02:10 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by Crow View Post
As far as I know, a player has to be online to be reset.
Not to my knowledge.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #17  
Old 01-17-2009, 10:57 PM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Quote:
Originally Posted by cbk1994 View Post

I imagine something like this would work, but I've never tried anything like it. No rights should be needed; loadFolder works with no read rights as far as I know.
Ah yes, I've done that before. It seems to work fine.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
Reply


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

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

Forum Jump


All times are GMT +2. The time now is 04:26 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.