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 12-05-2009, 03:43 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
spar script.

This code had been working fine for months, and now it just up and stopped working. nothing has been changed whatsoever as far as i know. any ideas?

PHP Code:
function onCreated()
{
  
this.attr[10] = false;

  
this.spar_list "";

  
UpdateList();
  
this.setshape(13232);
}
function 
onPlayerEnters()
{
  
CheckSparList();

  if (
InSpar(player))
  {
    
player.30.5;
    
player.47;
  }
}
function 
onPlayerLeaves()
{
  if (
GetSparNumber() < 2)
    
this.attr[10] = false;
}
function 
onPlayerChats()
{
  if (
player.chat.starts("/join"))
  {
    if (!(
player.account in this.spar_list))
    {
      if (!
InSpar(player))
      {
        
this.spar_list.add(player.account);

        
CheckSparList();
      }
    }
  }
  if (
player.chat == "/leave")
  {
    if (
InSpar(player))
    {
      if (
this.attr[10] == false)
      {
        
player.30.5;
        
player.47;

        
CheckSparList();
      }
    }
  }
  if (
player.chat == "start")
  {
    if (
GetSparNumber() == 2)
    {
      if (
this.attr[10] == false)
      {
        if (
InSpar(player))
        {
          for (
pl:players)
          {
            
pl.hearts 20;
            if (
pl.account != player.account && InSpar(pl))
            {
              if (
pl.chat == "start")
                
BeginSpar();
            }
          }
        }
      }
    }
  }
  if (
player.chat == "end")
  {
    if (
GetSparNumber() == 2)
    {
      if (
this.attr[10] == true)
      {
        if (
InSpar(player))
        {
          for (
pl:players)
          {
            if (
pl.account != player.account && InSpar(pl))
            {
              if (
pl.chat == "end")
                
this.attr[10] = false;
            }
          }
        }
      }
    }
    else
      
this.attr[10] = false;
  }
}
function 
BeginSpar()
{
  
this.attr[10] = "starting";

  
putbomb(13125);

  
sleep(3);

  
this.attr[10] = true;
}
function 
onPlayerDies()
{
  for(
pl:players)
    
pl.hearts 20;

  if (
InSpar(player))
  {
    
this.attr[10] = false;

    
player.hearts 20;

    
player.30.5;
    
player.47;

    
CheckSparList();
  }
}
function 
CheckSparList()
{
  if (
this.spar_list.size() > 0)
  {
    if (
GetSparNumber() < 2)
    {
      
findplayer(this.spar_list[0]).30.5;
      
findplayer(this.spar_list[0]).24;

      
findplayer(this.spar_list[0]).ap 50;

      
findplayer(this.spar_list[0]).hearts 20;

      
this.spar_list.delete(0);

      
CheckSparList();
    }
  }
  
UpdateList();
}
function 
GetSparNumber()
{
  
temp.spar_p 0;

  for(
pl:players)
  {
    if (
InSpar(pl))
      
temp.spar_p ++;
  }

  return 
temp.spar_p;
}
function 
InSpar(pl)
{
  if (
pl.x+1.5 in |1747| && pl.y+2 in |1537|)
    return 
true;
  else
    return 
false;
}
function 
UpdateList()
{
  if (
this.spar_list.size() > 0)
    
this.chat "Line: " this.spar_list;
  else
    
this.chat "No Line!";
}
//#CLIENTSIDE
function onCreated()
{
  
enablefeatures(allfeatures-0x80);
  
disableweapons();
  
setTimer(.05);
  
this.setshape(13232);
}
function 
onPlayerDies()
  
freezeplayer(.5);
function 
onTimeout()
{
  
enableweapons();
  
disablemap();
  if (
player.x+1.5 in |1747| && player.y+2 in |1537|)
  {
    if (
this.attr[10] == true)
    {
      
enablefeatures(allfeatures-1-2-4-0x10-0x20-0x80);
    }
    else{
      
enablefeatures(allfeatures-0x80);
      
disableweapons();
    }
  }
  else{
    
enablefeatures(allfeatures-0x80);
    
disableweapons();
  }
  
setTimer(.05);

__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #2  
Old 12-05-2009, 03:58 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
lol that's GScript for ya.

Could you be more specific?

Side note: You should probably make functions for joining, leaving, ending to trim off the fat in playerchats. Also commenting your code doesn't hurt either.
__________________
Quote:
Reply With Quote
  #3  
Old 12-05-2009, 04:02 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Sorry, I meant to say its not showing the line. Ive tried this.chat and message(), doesnt do anything. Used to last I checked though... kind of weird.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #4  
Old 12-05-2009, 04:09 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 sssssssssss View Post
Sorry, I meant to say its not showing the line. Ive tried this.chat and message(), doesnt do anything. Used to last I checked though... kind of weird.
The issue:

PHP Code:
Script compiler output for Class asdf:
error: function onCreated redefined at line 170: function onCreated()
error: function onPlayerDies redefined at line 177: function onPlayerDies()
Script asdf updated by fowlplay4 
Alright that's a little weird but..

PHP Code:
function onCreated() 

  
this.attr[10] = false

  
this.spar_list ""

  
UpdateList(); 
  
this.setshape(13232); 

function 
onPlayerEnters() 

  
CheckSparList(); 

  if (
InSpar(player)) 
  { 
    
player.30.5
    
player.47
  } 

function 
onPlayerLeaves() 

  if (
GetSparNumber() < 2
    
this.attr[10] = false

function 
onPlayerChats() 

  if (
player.chat.starts("/join")) 
  { 
    if (!(
player.account in this.spar_list)) 
    { 
      if (!
InSpar(player)) 
      { 
        
this.spar_list.add(player.account); 

        
CheckSparList(); 
      } 
    } 
  } 
  if (
player.chat == "/leave"
  { 
    if (
InSpar(player)) 
    { 
      if (
this.attr[10] == false
      { 
        
player.30.5
        
player.47

        
CheckSparList(); 
      } 
    } 
  } 
  if (
player.chat == "start"
  { 
    if (
GetSparNumber() == 2
    { 
      if (
this.attr[10] == false
      { 
        if (
InSpar(player)) 
        { 
          for (
pl:players
          { 
            
pl.hearts 20
            if (
pl.account != player.account && InSpar(pl)) 
            { 
              if (
pl.chat == "start"
                
BeginSpar(); 
            } 
          } 
        } 
      } 
    } 
  } 
  if (
player.chat == "end"
  { 
    if (
GetSparNumber() == 2
    { 
      if (
this.attr[10] == true
      { 
        if (
InSpar(player)) 
        { 
          for (
pl:players
          { 
            if (
pl.account != player.account && InSpar(pl)) 
            { 
              if (
pl.chat == "end"
                
this.attr[10] = false
            } 
          } 
        } 
      } 
    } 
    else 
      
this.attr[10] = false
  } 

function 
BeginSpar() 

  
this.attr[10] = "starting"

  
putbomb(13125); 

  
sleep(3); 

  
this.attr[10] = true

function 
onPlayerDies() 

  for(
pl:players
    
pl.hearts 20

  if (
InSpar(player)) 
  { 
    
this.attr[10] = false

    
player.hearts 20

    
player.30.5
    
player.47

    
CheckSparList(); 
  } 

function 
CheckSparList() 

  if (
this.spar_list.size() > 0
  { 
    if (
GetSparNumber() < 2
    { 
      
findplayer(this.spar_list[0]).30.5
      
findplayer(this.spar_list[0]).24

      
findplayer(this.spar_list[0]).ap 50

      
findplayer(this.spar_list[0]).hearts 20

      
this.spar_list.delete(0); 

      
CheckSparList(); 
    } 
  } 
  
UpdateList(); 

function 
GetSparNumber() 

  
temp.spar_p 0

  for(
pl:players
  { 
    if (
InSpar(pl)) 
      
temp.spar_p ++; 
  } 

  return 
temp.spar_p


function 
InSpar(pl

  if (
pl.x+1.5 in |1747| && pl.y+2 in |1537|) 
    return 
true
  else 
    return 
false


function 
UpdateList() 

  if (
this.spar_list.size() > 0
    
this.chat "Line: " this.spar_list
  else 
    
this.chat "No Line!"
}
 
//#CLIENTSIDE
 
function onCreated() 

  
enablefeatures(allfeatures-0x80); 
  
disableweapons(); 
  
setTimer(.05); 
  
this.setshape(13232); 

function 
onPlayerDies() 
{
  
freezeplayer(.5); 
}

function 
onTimeout() 

  
enableweapons(); 
  
disablemap(); 
  if (
player.x+1.5 in |1747| && player.y+2 in |1537|) 
  { 
    if (
this.attr[10] == true
    { 
      
enablefeatures(allfeatures-1-2-4-0x10-0x20-0x80); 
    } 
    else{ 
      
enablefeatures(allfeatures-0x80); 
      
disableweapons(); 
    } 
  } 
  else{ 
    
enablefeatures(allfeatures-0x80); 
    
disableweapons(); 
  } 
  
setTimer(.05); 

Works fine, but you need to have a blank line after the clientside or else it doesn't compile it properly. Neat huh?

For the sake of the future scripts on your server, I'd recommend having all enablefeatures/showstats get done in a weapon-script system, so you can actually keep track of it before it's too late.
__________________
Quote:
Reply With Quote
  #5  
Old 12-05-2009, 04:09 AM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
Wouldn't NPC chat be disabled if text is disabled via the 0x80 feature?
Reply With Quote
  #6  
Old 12-05-2009, 04:37 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
It should just be player chat, being the player vs player, and player streak is showing up fine.

Also, it may not be loading for me properly, b/c sometimes gmaps take like a day to load for me for some reason on here, but its still not working.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #7  
Old 12-05-2009, 04:53 AM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
I've just tested it, the feature does also hide NPC chat aswell as players, and by the looks of the script is being used regardless of whether the player is sparring or not.

If your intention was for chat to only be disabled while you are sparring you should only be including the - 0x80 part here -

PHP Code:
if (player.x+1.5 in |1747| && player.y+2 in |1537|)  
  {  
    if (
this.attr[10] == true)  
    {  
      
enablefeatures(allfeatures-1-2-4-0x10-0x20-0x80);  
    } 
Though I personally don't think default chat is a decent method of displaying a queue line, could probably get messy if it became big, with Classics arena system I have the queue stored as an Attr value (tokenized and processed whenever it changes), front 2 sparrers with their heads + names displayed as a showimg on screen, and your position within the queue displayed by showtext if behind the front 2.
Reply With Quote
  #8  
Old 12-05-2009, 04:57 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
well we have a custom chat sys, so its not just for the spar, ill have to put it in a wep, no biggie.

thanks for the test, and the advice.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #9  
Old 12-05-2009, 10:39 PM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
Quote:
Originally Posted by sssssssssss View Post
Also, it may not be loading for me properly, b/c sometimes gmaps take like a day to load for me for some reason on here, but its still not working.
You mean when just updated? Use "/updatelevel gmapname.gmap" in RC.
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
  #10  
Old 12-06-2009, 01:47 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
That doesnt always work. its weird, gmaps just take like a day to load, and its not just for me. I dunno why. tried the rc /updatelevel. no biggie tho.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


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 11:19 AM.


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