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 10-14-2007, 08:36 AM
TSAdmin TSAdmin is offline
Forum Moderator
TSAdmin's Avatar
Join Date: Aug 2006
Location: Australia
Posts: 1,980
TSAdmin has much to be proud ofTSAdmin has much to be proud ofTSAdmin has much to be proud ofTSAdmin has much to be proud ofTSAdmin has much to be proud ofTSAdmin has much to be proud of
Player Levels

I have this weapon that allows me to use chat to trigger occurances upon myself or specified players. Things like :osl Account to send someone to OSL immediately. Anyway, I got toying with doing it with all players in the same level as myself and hit a brick wall. To test, I merely used chat rather than jumping right to setLevel2. I stood in a level with around 20 players in it and triggered it with the :test command and it's only finding 1 or 2 people in the same level as me. Basically, could someone check this out and see if I'm missing something. I sought help from kinetaro, and he added the temp stuff to it as he said for messes with player.account sometimes, but even he was unable to figure out why it wasn't working.

PHP Code:
else if (toks[0] == ":test") {
      if (
player.account in this.allowedFull) {
      
this.tempacc player.account;
        for (
plallplayers) {
          if (
pl.level.name == findPlayer(thiso.tempacc).level.name && pl.level != null) {
            
pl.chat pl.account;
            return;
          }
        }
      }
    } 
Any clues?
__________________
TSAdmin (Forum Moderator)
Welcome to the Official GraalOnline Forums! Where sharing an opinion may be seen as a declaration of war!
------------------------
· User Agreement · Code of Conduct · Forum Rules ·
· Graal Support · Administrative Contacts ·
Reply With Quote
  #2  
Old 10-14-2007, 08:40 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
findPlayer(thiso.tempacc).level.name is obselete, try replacing it with player.level.name - you never, ever, use findPlayer() to access the current player.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #3  
Old 10-14-2007, 08:41 AM
TSAdmin TSAdmin is offline
Forum Moderator
TSAdmin's Avatar
Join Date: Aug 2006
Location: Australia
Posts: 1,980
TSAdmin has much to be proud ofTSAdmin has much to be proud ofTSAdmin has much to be proud ofTSAdmin has much to be proud ofTSAdmin has much to be proud ofTSAdmin has much to be proud of
Quote:
Originally Posted by xXziroXx View Post
findPlayer(thiso.tempacc).level.name is obselete, try replacing it with player.level.name - you never, ever, use findPlayer() to access the current player.
player.level.name was what I had originally, that thiso was something kine threw in. Neither worked.
__________________
TSAdmin (Forum Moderator)
Welcome to the Official GraalOnline Forums! Where sharing an opinion may be seen as a declaration of war!
------------------------
· User Agreement · Code of Conduct · Forum Rules ·
· Graal Support · Administrative Contacts ·
Reply With Quote
  #4  
Old 10-14-2007, 08:43 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
&& pl.level.name != null instead of && pl.level != null? I probably wont be making much sense, as I havent slept for over a day.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #5  
Old 10-14-2007, 08:48 AM
TSAdmin TSAdmin is offline
Forum Moderator
TSAdmin's Avatar
Join Date: Aug 2006
Location: Australia
Posts: 1,980
TSAdmin has much to be proud ofTSAdmin has much to be proud ofTSAdmin has much to be proud ofTSAdmin has much to be proud ofTSAdmin has much to be proud ofTSAdmin has much to be proud of
Quote:
Originally Posted by xXziroXx View Post
&& pl.level.name != null instead of && pl.level != null? I probably wont be making much sense, as I havent slept for over a day.
You should get some sleep, then. Anyway, this is basically what I had before I got kine to check it out:

PHP Code:
else if (toks[0] == ":test") {
      if (
player.account in this.allowedFull) {
        for (
plallplayers) {
          if (
pl.level.name == player.level.name && pl.level.name != null) {
            
pl.chat pl.account;
            return;
          }
        }
      }
    } 
Which, going by what you have told me, should work as expected, which is why when it didn't I sought such help :s It hates me, rofl.
__________________
TSAdmin (Forum Moderator)
Welcome to the Official GraalOnline Forums! Where sharing an opinion may be seen as a declaration of war!
------------------------
· User Agreement · Code of Conduct · Forum Rules ·
· Graal Support · Administrative Contacts ·
Reply With Quote
  #6  
Old 10-14-2007, 08:54 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
If you want to access people in the current level, why not use players instead of allplayers?


PHP Code:
else if (toks[0] == ":test") {
  if (
player.account in this.allowedFull) {
    for (
plplayers) {
      
pl.chat pl.account;
      return;
    }
  }

And yes, sleep is next on today's schedule.. I think.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #7  
Old 10-14-2007, 09:01 AM
TSAdmin TSAdmin is offline
Forum Moderator
TSAdmin's Avatar
Join Date: Aug 2006
Location: Australia
Posts: 1,980
TSAdmin has much to be proud ofTSAdmin has much to be proud ofTSAdmin has much to be proud ofTSAdmin has much to be proud ofTSAdmin has much to be proud ofTSAdmin has much to be proud of
Sadly, I also thought of that Still nothing.
__________________
TSAdmin (Forum Moderator)
Welcome to the Official GraalOnline Forums! Where sharing an opinion may be seen as a declaration of war!
------------------------
· User Agreement · Code of Conduct · Forum Rules ·
· Graal Support · Administrative Contacts ·
Reply With Quote
  #8  
Old 10-14-2007, 09:04 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
I told Novo to take a look at the thread, I'm too tired for coding right now. Hopefully he'll help you out.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #9  
Old 10-14-2007, 09:06 AM
TSAdmin TSAdmin is offline
Forum Moderator
TSAdmin's Avatar
Join Date: Aug 2006
Location: Australia
Posts: 1,980
TSAdmin has much to be proud ofTSAdmin has much to be proud ofTSAdmin has much to be proud ofTSAdmin has much to be proud ofTSAdmin has much to be proud ofTSAdmin has much to be proud of
Quote:
Originally Posted by xXziroXx View Post
I told Novo to take a look at the thread, I'm too tired for coding right now. Hopefully he'll help you out.
Alright, thanks Sleep well
__________________
TSAdmin (Forum Moderator)
Welcome to the Official GraalOnline Forums! Where sharing an opinion may be seen as a declaration of war!
------------------------
· User Agreement · Code of Conduct · Forum Rules ·
· Graal Support · Administrative Contacts ·
Reply With Quote
  #10  
Old 10-14-2007, 09:08 AM
Novo Novo is offline
[TServerDeveloper]
Join Date: Jun 2006
Posts: 448
Novo will become famous soon enough
The return causes the function to terminate.
Reply With Quote
  #11  
Old 10-14-2007, 09:10 AM
Novo Novo is offline
[TServerDeveloper]
Join Date: Jun 2006
Posts: 448
Novo will become famous soon enough
PHP Code:
if (toks[0] == ":test")
  {
//      if (player.account in this.allowedFull) { 
        
for (plallplayers) { 
          if (
pl.level.name != player.level.name )
            continue;

          
pl.chat pl.account
        } 
//      } 
    

This is what I'd use for testing.
Reply With Quote
  #12  
Old 10-14-2007, 09:29 AM
TSAdmin TSAdmin is offline
Forum Moderator
TSAdmin's Avatar
Join Date: Aug 2006
Location: Australia
Posts: 1,980
TSAdmin has much to be proud ofTSAdmin has much to be proud ofTSAdmin has much to be proud ofTSAdmin has much to be proud ofTSAdmin has much to be proud ofTSAdmin has much to be proud of
NOVO WINS, lmao... stupid me, actually was using : as the initiating symbol in this example, and it was meant to be /

Thanks, rofl <3
__________________
TSAdmin (Forum Moderator)
Welcome to the Official GraalOnline Forums! Where sharing an opinion may be seen as a declaration of war!
------------------------
· User Agreement · Code of Conduct · Forum Rules ·
· Graal Support · Administrative Contacts ·
Reply With Quote
  #13  
Old 10-14-2007, 09:50 AM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
although, since you're only wanting to find a specific player I wouldn't use players/allplayers...

HTML Code:
//pars = [0-action]
if (temp.action == "summon") {
  findPlayer(params.substring(temp.action.length() + 1)).setlevel2(player.level.name, player.x, player.y);
}
oh, just re-read my bad

HTML Code:
if (temp.action == "summon") {
  for (temp.i: players) {
    temp.i.setlevel2(player.level.name, player.x, player.y);
  }
}
this will cause everyone in your level to be warped to that position
__________________
Reply With Quote
  #14  
Old 10-14-2007, 10:41 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
return: Leaves the function and returns parameters to the function caller.
break: Immediately ends the loop or switch and jumps to the end of it.
continue: Ends the current step of the while/for loop and continues with the next one.

Make sure you remember which is which
__________________
Do it with a DON!
Reply With Quote
  #15  
Old 10-14-2007, 07:49 PM
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
Geez, would have thought I'd notice such a thing even when tired like hell.
__________________
Follow my work on social media post-Graal:Updated august 2025.
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 09:23 PM.


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