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 04-16-2005, 07:03 PM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
GS2 Radio

Well, my new radio for gs2, for some reason or another, isn't working. I can't really figure out why, can anyone help me?

PHP Code:
//Made by *Admin-Playerworld108
//A.K.A. Vash-Aniki

//Define Functions
function showtitle() {
  
showtext(201,100,0,Arial,b,"Song:"@getstring[serverr.radiotitle]);
  
changeimgvis(201,4);
}
function 
songplay() {
  
play(getstring[serverr.radiosong]);
}
function 
showchat() {
  
showtext(202,100,30,Arial,b,"Chat:"@getstring[serverr.radiochat]);
  
changeimgvis(202,4);
}
function 
onactionserverside() {
  if (
param[0]=="songchange") {
    
serverr.radiosong variable[param[1]];
    for (
i=0;i<allplayerscount;i++) {
      
with (allplayers[i]) {
        if (
client.radiolisten) {
          
songplay();
        }
      }
    }
  }
  if (
param[0]=="titlechange") {
    
serverr.radiotitle variable[param[1]];
    for (
i=0;i<allplayercount;i++) {
      
with (allplayers[i]) {
        if (
client.radiolisten) {
          
showtitle();
        }
      }
    }
  }
  if (
param[0]="chatchange") {
    
serverr.radiochat variable[param[1]];
    for (
i=0;i<allplayerscount;i++) {
      
with (allplayers[i]) {
        if (
client.radiolisten) {
          
showchat();
        }
      }
    }
  }
}

//#CLIENTSIDE
if (player.chat == "/radioon") {
  
set(client.radiolisten);
  
player.chat "Radio On!";
  
songplay();
  
showtitle();
  
showchat();
}
if (
startswith ("/song ",player.chat)) {
  if (
client.radiochanger) {
    
tokenize player.chat;
    
triggeraction(0,0,serverside,Radio,songchange,tokens[1]);
    
player.chat "Song Changed!";
  }
}
if (
startswith ("/title ",player.chat)) {
  if (
client.radiochanger) {
    
tokenize player.chat;
    
triggeraction(0,0,serverside,Radio,titlechange,tokens[1]);
    
player.chat "Title Changed!";
  }
}
if (
startswith ("/chat ",player.chat)) {
  if (
client.radiochanger) {
    
tokenize player.chat;
    
triggeraction(0,0,serverside,Radio,titlechange,tokens[1]);
    
player.chat "Title Changed";
  }
}
if (
player.chat == "/radiooff") {
  unset(
client.radiolisten);
  
stopsound(getstring[serverr.radiosong]);
  
hideimg(201);
  
hideimg(202);

__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #2  
Old 04-16-2005, 07:10 PM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
KSI-GS.
__________________
Reply With Quote
  #3  
Old 04-16-2005, 10:03 PM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Yeah, I've read that like 3 times
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #4  
Old 04-16-2005, 11:03 PM
Rick Rick is offline
PipBoy Extraordinaire!
Rick's Avatar
Join Date: Jul 2004
Location: Long Beach, California.
Posts: 831
Rick is on a distinguished road
Quote:
Originally Posted by coreys
Yeah, I've read that like 3 times
You have functions in global scope, this is very bad.
Reply With Quote
  #5  
Old 04-17-2005, 01:15 AM
Velox Cruentus Velox Cruentus is offline
Registered User
Velox Cruentus's Avatar
Join Date: Dec 2004
Location: Quebec, Canada
Posts: 465
Velox Cruentus is on a distinguished road
Send a message via ICQ to Velox Cruentus Send a message via AIM to Velox Cruentus
what rick said + You're calling serverside functions clientside.

You don't need to do getstring[serverr.radiosong]

play command is clientside, I do believe.
showimg => Clientside.

serverside isn't a string. Quote it.
Radio isn't a string, it's an object. Put it in quotes, or put this.name instead.
quote "songchange" and the rest.

Use switch commands?

Don't bother with variable[]

variables do not contain spaces "tok ens[x]"


Umm.... That's just off the top of my head.
__________________
In a world of change... Who'll you believe?
Reply With Quote
  #6  
Old 04-17-2005, 01:31 AM
Velox Cruentus Velox Cruentus is offline
Registered User
Velox Cruentus's Avatar
Join Date: Dec 2004
Location: Quebec, Canada
Posts: 465
Velox Cruentus is on a distinguished road
Send a message via ICQ to Velox Cruentus Send a message via AIM to Velox Cruentus
PHP Code:
// NPC Made by Velox Cruentus
function onactionserverside()
{
  switch (
params[0])
  {
    case 
"title":
    {
      
serverr.radio[0] := params[1];
      break;
    }
    case 
"chat":
    {
       
serverr.radio[1] := params[1];
       break;
    }
    case 
"song":
    {
       
serverr.radio[2] := params[1];
       break;
    }
  }
  for (
pallplayers){
    
with (p)
    {
       
triggeraction(0,0,"clientside","Radio","update");
    }
  }
}
//#CLIENTSIDE
function onplayerchats()
{
  if (
clientr.radioon == true)
  {
    
tok := player.chat.tokenize();
    switch (
tok[0])
    {
       case 
"radiooff":
       {
         
hideimgs(201,202);
         
stopsound();
         
client.radio := false;
         break;
       }
       case 
"chat":
       case 
"title":
       case 
"song":
       {
          
triggeraction(0,0,"serverside",this.name,tok[0],player.chat.substring(tok[0].length(),-1).Trim());
         break;
       }
    }
  } else if (
player.chat == "radioon")
  {
    
client.radio := true;
    
onactionclientside("update");
  }
}

function 
onactionclientside()
{
  if (
params[0] == "update")
  {
    if (
client.radio == true)
    {
      
showtitle(serverr.radio[0]);
      
showchat(serverr.radio[1]);
      
play(serverr.radio[2]);
    }
  }
}
function 
showtitle(text) {
  
showtext(201,100,0,"Arial","b","Song: "text);
  
changeimgvis(201,4);
}
function 
showchat(text) {
  
showtext(202,100,30,"Arial","b","Chat: " text);
  
changeimgvis(202,4);

__________________
In a world of change... Who'll you believe?
Reply With Quote
  #7  
Old 04-17-2005, 11:02 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Quote:
Originally Posted by coreys
Yeah, I've read that like 3 times
Next, try following it.
__________________
Reply With Quote
  #8  
Old 04-18-2005, 01:20 AM
Rick Rick is offline
PipBoy Extraordinaire!
Rick's Avatar
Join Date: Jul 2004
Location: Long Beach, California.
Posts: 831
Rick is on a distinguished road
Quote:
Originally Posted by Rick
You have functions in global scope, this is very bad.
I meant code, not functions.

(For some reason I can't edit my own posts.)
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 08:37 PM.


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