Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #16  
Old 06-26-2013, 05:07 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
Quote:
Originally Posted by fowlplay4 View Post
This could probably be optimized to use onAllRCChat now.
I was actually working on something similar recently, with the idea being to capture the account of the person making the change as well, so that could be passed to gsync and used to commit the change to source control under their name. Also works for level uploads (which are essentially text, after all). It's a lot messier than yours, but this is what I came up with:

PHP Code:
function onAllRCChat(temp.msg) {  
  if (
temp.msg.starts("Script ") && temp.msg.pos(" updated by ") > (- 1)) {
    
temp.tokens temp.msg.tokenize();
    
temp.acc temp.tokens[temp.tokens.size() - 1];
    
this.handleUpdate(temp.acc, {{"script"temp.tokens[1]}});
  } else if (
temp.msg.starts("Script ") && temp.msg.pos(" deleted by ") > (- 1)) {
    
temp.tokens temp.msg.tokenize();
    
temp.acc temp.tokens[temp.tokens.size() - 1];
    
this.handleUpdate(temp.acc, {{"script"temp.tokens[1]}});
  } else if (
temp.msg.starts("The script of NPC ") && temp.msg.pos(" has been updated by ") > (- 1)) {
    
temp.tokens temp.msg.tokenize();
    
temp.acc temp.tokens[temp.tokens.size() - 1];
    
this.handleUpdate(temp.acc, {{"npc"temp.tokens[4]}});
  } else if (
temp.msg.starts("NPC ") && temp.msg.pos(" has been added by ") > (- 1)) {
    
temp.tokens temp.msg.tokenize();
    
temp.acc temp.tokens[temp.tokens.size() - 1];
    
this.handleUpdate(temp.acc, {{"npc"temp.tokens[1]}});
  } else if (
temp.msg.starts("The npc ") && temp.msg.pos(" has been deleted by ") > (- 1)) {
    
temp.tokens temp.msg.tokenize();
    
temp.acc temp.tokens[temp.tokens.size() - 1];
    
this.handleUpdate(temp.acc, {{"npc"temp.tokens[2]}});
  } else if (
temp.msg.starts("The flags of NPC ") && temp.msg.pos(" have been updated by ") > (- 1)) {
    
temp.tokens temp.msg.tokenize();
    
temp.acc temp.tokens[temp.tokens.size() - 1];
    
this.handleUpdate(temp.acc, {{"npc"temp.tokens[4]}});
  } else if (
temp.msg.starts("Weapon/GUI-script ") && temp.msg.pos(" added/updated by ") > (- 1)) {
    
temp.tokens temp.msg.tokenize();
    
temp.acc temp.tokens[temp.tokens.size() - 1];
    
this.handleUpdate(temp.acc, {{"weapon"temp.tokens[1]}});
  } else if (
temp.msg.starts("Weapon ") && temp.msg.pos(" deleted by ") > (- 1)) {
    
temp.tokens temp.msg.tokenize();
    
temp.acc temp.tokens[temp.tokens.size() - 1];
    
this.handleUpdate(temp.acc, {{"weapon"temp.tokens[1]}});
  }
}

// figure out who uploaded it by checking rclog.txt
function onLevelFileUpdated(temp.file) {
  
temp.file "levels/" temp.file;
  
  if (! 
temp.file.ends(".nw") && ! temp.file.ends(".gmap")) {
    return;
  }
  
  
temp.log.loadLines("logs/rclog.txt");
  
temp.lastLog temp.log[temp.log.size() - 1];
  
  
temp.acc "(npcserver)";
  
  if (
temp.lastLog.pos(temp.file) > (- 1)) {
    
temp.tokens temp.lastLog.tokenize();
    
temp.acc temp.tokens[0];
  }
  
  
this.handleUpdate(temp.acc, {{"file"temp.file}});
}

// public so this can also be hooked into online level/NPC editors
public function handleUpdate(temp.acctemp.files) {
  echo(
temp.acc ": " temp.files);

If I get some free time I might see about finishing this. It would be nice if gsync could work on a single changed file, rather than having to check every file every time. Also, you could store the account of the player, which is nifty to stick in source control.
__________________
Reply With Quote
  #17  
Old 12-27-2013, 01:29 AM
JohnnyChimpo JohnnyChimpo is offline
Registered User
JohnnyChimpo's Avatar
Join Date: Jun 2004
Posts: 105
JohnnyChimpo is on a distinguished road
Ive been trying to get this hooked up to a home server i have but i cant figure out why its giving me a CURL not authorized error. The key is correct the server IP is correct, and i have my apache2 server linking to the folder that the php file is in(all permissions are correct). I just cant figure this out, any help would be much appreciated.
Reply With Quote
  #18  
Old 12-27-2013, 02:16 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
It's probably blocked on the Graal server end.
__________________
Quote:
Reply With Quote
  #19  
Old 12-27-2013, 02:41 AM
JohnnyChimpo JohnnyChimpo is offline
Registered User
JohnnyChimpo's Avatar
Join Date: Jun 2004
Posts: 105
JohnnyChimpo is on a distinguished road
Must be because i was certain i did everything correct. What is the standard for backing up graal server files now that this script is broken? Or is there a way i can ask Stefan to enable this for my server?
Reply With Quote
  #20  
Old 12-27-2013, 02:54 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:
Originally Posted by JohnnyChimpo View Post
Must be because i was certain i did everything correct. What is the standard for backing up graal server files now that this script is broken? Or is there a way i can ask Stefan to enable this for my server?
It's been a while now that the community has asked for a standard backup... unfortunately nothing has ever been made.
__________________
http://i.imgur.com/OOJbW.jpg
Reply With Quote
  #21  
Old 12-27-2013, 03: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 JohnnyChimpo View Post
Must be because i was certain i did everything correct. What is the standard for backing up graal server files now that this script is broken? Or is there a way i can ask Stefan to enable this for my server?
Give yourself:

PHP Code:
rw scripts/*
rw npcs/*
rw weapons/*
-r npcs/npclocalnpc* 
Download files manually then zip them or maintain your own git repo.
__________________
Quote:
Reply With Quote
  #22  
Old 12-27-2013, 03:23 AM
JohnnyChimpo JohnnyChimpo is offline
Registered User
JohnnyChimpo's Avatar
Join Date: Jun 2004
Posts: 105
JohnnyChimpo is on a distinguished road
Okay, i guess that will have to do, thanks for the knowledge =D.
Reply With Quote
  #23  
Old 12-27-2013, 08:59 AM
Joshua_P2P Joshua_P2P is offline
Graal Developer
Joshua_P2P's Avatar
Join Date: Dec 2012
Posts: 74
Joshua_P2P is on a distinguished road
So basically the short way is that it won't work anymore? i originally used this for pm logs and now everytime someone pms it sends me this error in rc
The CURL connection to http://aaronjy.zxq.net/graal/pmlist.php is not authorized on this server
__________________
Keeping it real in Graal since 2010
Reply With Quote
  #24  
Old 12-27-2013, 04:36 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
My understanding is that Stefan has to explicitly whitelist outgoing connections now.
__________________
Reply With Quote
  #25  
Old 12-27-2013, 04:39 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Quote:
Originally Posted by cbk1994 View Post
My understanding is that Stefan has to explicitly whitelist outgoing connections now.
Yep, it's been that way for a while. Sad really since there's even more restriction on what we're capable of doing. :/
__________________
Reply With Quote
  #26  
Old 12-27-2013, 04:40 PM
JohnnyChimpo JohnnyChimpo is offline
Registered User
JohnnyChimpo's Avatar
Join Date: Jun 2004
Posts: 105
JohnnyChimpo is on a distinguished road
The sad part is that people like me pay to be restricted from development like this. lol
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 07:19 PM.


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