Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-30-2016, 03:59 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
Lightbulb Max loop limit question

Been a while!

Anywho, tasked with finding a way to trace a players account from email.
This is to find offline players rather than just online, e.g. helping to recover lost accounts where the player has lost access to the email account but still knows the email address that was used to identify etc.

I seem to have hit an issue with what I assume are limits imposed by the internals of Graal, my method of getting a list of all the accounts ever used to check against was looping through the player houses folder:

PHP Code:
function onCreated(){
  
this.maxlooplimit 15000;
  echo(
this.maxlooplimit); //Echos 15000
  
LookFor("[email protected]"1);
}

//Params:
// st - string  - Either IP or Email.
// sw - integer - 0 for IP, 1 for Email.
function LookFor(st,sw){
  
temp.0;
  
temp.0;
  
temp.list = new[0];
  
temp.fold = new[15000];
  
temp.fold.loadfolder("levels/houses/players/*Graal*"false);
  echo(
"Looking for "@st@" in "@fold.size()@" houses");
  
temp.fold[10123] = "test";
  echo(
fold[10123]);
  for(
temp.temp.fold){
    
temp.acc temp.i.tokenize("_")[1];
    
//Skip PC accs, since they haven't identified.
    
if(acc.substring(05) != "Graal") continue;
    
temp.= new TServerPlayer(@acc);
    if(
sw){
      
//Look for Email
      
if(st.lower() == p.client.email.lower()){
        echo(
"Found player: "@acc);
        
temp.1;
        break;
      }
    }else{
      
//Look for IP
    
}
  }
  if(!
temp.f) echo("Unable to locate player.");
  
temp.p.destroy();

This is the RC output, any ideas?

The script of NPC Gund_Lookup has been updated by Gund
15000
Looking for [email protected] in 10000 houses
Unable to locate player.
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #2  
Old 06-30-2016, 06:14 AM
BlueMelon BlueMelon is offline
asdfg
BlueMelon's Avatar
Join Date: Sep 2008
Posts: 1,481
BlueMelon is a splendid one to beholdBlueMelon is a splendid one to beholdBlueMelon is a splendid one to beholdBlueMelon is a splendid one to behold
Quote:
The script of NPC Gund_Lookup has been updated by Gund
15000
Is this the line you think you have a limit?

Because you have
Quote:
temp.fold = new[15000];
In your code. And you also have maxlooplimit set, but not sure of the conditions when that gets triggered tbh.
__________________
http://i.imgur.com/OOJbW.jpg
Reply With Quote
  #3  
Old 06-30-2016, 06:46 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
Quote:
Originally Posted by BlueMelon View Post
Is this the line you think you have a limit?

Because you have


In your code. And you also have maxlooplimit set, but not sure of the conditions when that gets triggered tbh.
Hmm I'm out of ideas then... Also hey, I remember you from when I was on Era PC ha

PHP Code:
temp.fold = new[15000]; 
Was my attempt when I thought maybe the default array size was 10k.

PHP Code:
  temp.fold[10123] = "test"
  echo(
fold[10123]); 
This also has no effect..
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #4  
Old 06-30-2016, 12:00 PM
MysticalDragon MysticalDragon is offline
Global Administration
MysticalDragon's Avatar
Join Date: Oct 2002
Location: Lynn Ma
Posts: 883
MysticalDragon is just really niceMysticalDragon is just really nice
Send a message via AIM to MysticalDragon Send a message via MSN to MysticalDragon
Quote:
Originally Posted by Gunderak View Post
Hmm I'm out of ideas then... Also hey, I remember you from when I was on Era PC ha

PHP Code:
temp.fold = new[15000]; 
Was my attempt when I thought maybe the default array size was 10k.
Default (Not sure if you can even change the max limitations) size is 9999.

PHP Code:
function onCreated() {
  
temp.fold = new[15000];  
  
temp.fold[9999] = {"test"};  
  echo(
temp.fold[9999]);  
}
The script of NPC Cache has been updated by Carlito
test

Echoes Test while

PHP Code:
function onCreated() {
  
temp.fold = new[15000];  
  
temp.fold[10000] = {"test"};  
  echo(
temp.fold[10000]);  
}
The script of NPC Cache has been updated by Carlito 
echoes nothing.

I also noticed the method in which you are using to get the players account. What if they don't have a player house? How I would personally do it without loading the accounts folder directly is every player that logs into the game register them in SQL.
__________________
~Delteria Support
~Playerworld Support
~PWA Chief
http://support.toonslab.com
[email protected]




Last edited by MysticalDragon; 06-30-2016 at 12:11 PM..
Reply With Quote
  #5  
Old 07-01-2016, 10:10 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
You can indeed raise the maxlooplimit on serverside and clientside.

However, it won't take effect until the next tick, so if you intend to do something that's loop-intensive onCreated() you're going to need to schedule it with scheduleEvent or timeout.
Reply With Quote
  #6  
Old 07-02-2016, 01:55 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
Quote:
Originally Posted by DustyPorViva View Post
You can indeed raise the maxlooplimit on serverside and clientside.

However, it won't take effect until the next tick, so if you intend to do something that's loop-intensive onCreated() you're going to need to schedule it with scheduleEvent or timeout.
I gave this a go with scheduleevent but still the same results, max is 10,000
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #7  
Old 07-03-2016, 04:44 PM
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
Quote:
Originally Posted by Gunderak View Post
I gave this a go with scheduleevent but still the same results, max is 10,000
If it's possible, try a timeout instead of a scheduleevent.
Reply With Quote
  #8  
Old 07-04-2016, 11:18 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by Gunderak View Post
I gave this a go with scheduleevent but still the same results, max is 10,000
PHP Code:
function onCreated() {
  
maxlooplimit 100001;
  
example();
}

function 
example() {
  for (
temp.0temp.99999temp.i++) {
    
temp.c++;
  }
  echo(
temp.c); // echos 99999

__________________
Quote:
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 01:02 PM.


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