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 08-21-2011, 06:27 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
On Zodiac I use text files, and onLevelFileUpdated() to allow people to edit the news.

When the news text file is updated, I store an updated copy in Control NPC. I.e:

PHP Code:
// Player Logs in
// Send them the News
function onPlayerLogin(pl) {
  
temp.news findnpc("Control-NPC").news;
  
pl.triggerclient("-YourNewsSystem""thegoodword"temp.news);
}

// News is updated
function onLevelFileUpdated(filename) {
  if (
filename == "news/news.txt") {
    
findnpc("Control-NPC").news.loadlines("levels/" filename);
    
updateEveryone();
  }
}

// Send Everyone the News
function updateEveryone() {
  
temp.news findnpc("Control-NPC").news;
  for (
temp.aallplayers) {
    
temp.a.triggerclient("-YourNewsSystem""thegoodword"temp.news);
  }

__________________
Quote:
Reply With Quote
  #2  
Old 08-21-2011, 07:08 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 always thought onLevelFileUpdated was only for files downloadable in game by the client, having seen that and confirmed that it does indeed work for any file uploaded this is going to make life a lot easier for certain things I wanted to make.

The more you know .
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:22 AM.


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