Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-21-2011, 10:55 PM
Astram Astram is offline
Era iPhone PR
Astram's Avatar
Join Date: Aug 2010
Posts: 324
Astram can only hope to improve
Send a message via AIM to Astram
Report System Help

PHP Code:
//#CLIENTSIDE
function onPlayerChats() {
if (
player.chat == "/report") {
Report_Window1.show();
  new 
GuiWindowCtrl("Report_Window1") {
    
profile GuiBlueWindowProfile;
    
clientrelative true;
    
clientextent "313,237";

    
canclose false;
    
canmaximize false;
    
canminimize false;
    
canmove true;
    
canresize true;
    
closequery false;
    
destroyonhide false;
    
text "Report System";
    
480;
    
159;

    new 
GuiTextEditCtrl("Report_TextEdit1") {
      
profile GuiBlueTextEditProfile;
      
height 20;
      
text "";
      
width 313;
      
45;
    }
    new 
GuiTextCtrl("Report_Text1") {
      
profile GuiBlueTextProfile;
      
height 20;
      
text "Use this system to report players who arent obeying the rules!";
      
width 301;
      
5;
    }
    new 
GuiTextCtrl("Report_Text2") {
      
profile GuiBlueTextProfile;
      
height 20;
      
text "Account Of Report";
      
width 91;
      
109;
      
26;
    }
    new 
GuiButtonCtrl("Report_Button1") {
      
profile GuiBlueButtonProfile;
      
height 17;
      
text "File Report";
      
width 155;
      
220;
    }
    new 
GuiButtonCtrl("Report_Button2") {
      
profile GuiBlueButtonProfile;
      
height 17;
      
text "Close";
      
width 159;
      
154;
      
220;
    }
    new 
GuiButtonCtrl("Report_Button3") {
      
profile GuiBlueButtonProfile;
      
height 19;
      
text "Load and Manage Reports";
      
width 191;
      
62;
      
201;
    }
    new 
GuiTextCtrl("Report_Text3") {
      
profile GuiBlueTextProfile;
      
height 20;
      
text "Reason To Report";
      
width 87;
      
108;
      
80;
    }
    new 
GuiTextEditCtrl("Report_TextEdit2") {
      
profile GuiBlueTextEditProfile;
      
height 20;
      
text "";
      
width 313;
      
113;
    }
  }
}
}

function 
Report_Button1.onAction() {
  
player.chat "Filed Report!";
  
serverr.player player.account;
  
serverr.account Report_TextEdit1.text;
  
serverr.reason Report_TextEdit2.text;
  
Report_Window1.hide();
}

function 
Report_Button2.onAction() {
  
Report_Window1.hide();
}

function 
Report_Button3.onAction() {
if (
player.guild == "Owner") {
echo(
"Report System: "@serverr.player@" reported "@serverr.account@" for "@serverr.reason@"!");
}

The Problem with this is that, I dont know how to send the text edit text, to the RC by pressing the file report button. Can someone please help?
__________________
-Toad
The worlds biggest Toad fan...
Era iPhone FTW!


Reply With Quote
  #2  
Old 02-21-2011, 11:07 PM
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 cbk1994 View Post
Nope. You can trigger either way back and forth as much as you want. You can create an infinite loop if you want:

PHP Code:
function onActionServerSide(cmd) {
  if (
cmd == "ping") {
    
triggerClient("gui"this.name"ping");
  }
}

//#CLIENTSIDE
function onCreated() {
  
triggerServer("gui"this.name"ping"); // start the loop
}

function 
onActionClientSide(cmd) {
  if (
cmd == "ping") {
    
this.counter ++;
    
player.chat "Pings: " this.counter;
    
triggerServer("gui"this.name"ping");
  }

Though obviously you wouldn't want to do something like that in practical scripting

You can also trigger weapons of other players.

PHP Code:
function onActionServerSide(cmdtargetmsg) {
  if (
cmd == "tell") {
    
temp.pl findPlayerByCommunityName(target);
    
    if (
pl == null) {
      return 
player.chat "(player not found)";
    }
    
    
pl.triggerClient("gui"this.name"tell"player.communitynamemsg);
  }
}

//#CLIENTSIDE
function onPlayerChats() {
  if (
player.chat.starts("tell")) { // format is: tell account "message here"
    
temp.tokens player.chat.tokenize();
    
    
temp.acc tokens[1];
    
temp.msg tokens[2];
    
    
triggerServer("gui"this.name"tell"accmsg);
  }
}

function 
onActionClientSide(cmdsendermsg) {
  if (
cmd == "tell") {
    
player.chat sender ": " msg;
  }

To use this you would say: tell cbk1994 "Hi there ugly!"

That would trigger serverside, try to find a player with the community name 'cbk1994', and if found, trigger clientside on the same weapon for that player. Once it receives the trigger clientside, it would set my chat to 'Engine: Hi there ugly!'.

This is a bit of a silly example since you can set players' chat serverside, but it could be used, for example, if you have some kind of GUI window displaying the message.
and a popular function to send messages to people on rc chat...

sendtorc(msg)
__________________
Quote:
Reply With Quote
  #3  
Old 02-22-2011, 02:00 AM
Astram Astram is offline
Era iPhone PR
Astram's Avatar
Join Date: Aug 2010
Posts: 324
Astram can only hope to improve
Send a message via AIM to Astram
That doesnt really help me, because that doesnt involve any GUIs
__________________
-Toad
The worlds biggest Toad fan...
Era iPhone FTW!


Reply With Quote
  #4  
Old 02-22-2011, 02:13 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
Your problem isn't with GUIs though, you use triggerserver to send the data (I.e: Report_TextEdit2.text) Reason from the client to the server and display it to RC using sendtorc.
__________________
Quote:
Reply With Quote
  #5  
Old 02-22-2011, 03:36 AM
Astram Astram is offline
Era iPhone PR
Astram's Avatar
Join Date: Aug 2010
Posts: 324
Astram can only hope to improve
Send a message via AIM to Astram
Quote:
Originally Posted by fowlplay4 View Post
Your problem isn't with GUIs though, you use triggerserver to send the data (I.e: Report_TextEdit2.text) Reason from the client to the server and display it to RC using sendtorc.
triggerclient()?
This seriously confuses me... New towards scripting Dx
__________________
-Toad
The worlds biggest Toad fan...
Era iPhone FTW!


Reply With Quote
  #6  
Old 02-22-2011, 04:12 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
Syntax: triggerserver(type, name, param, [...])

type - Depending on what you're doing this will usually be "gui" if you're using it in a weapon script. You can also trigger DB-NPCs by specifying "npc" instead.

name - Name of object to trigger, you'll most often be specifying the weapon/npc's name by using it's this.name value.

param - Short for parameter, this is the data you are sending to the server.

... - (Optional) You can specify as many additional parameters as you want, if you need more than 10 you probably need to re-think your approach.

Example: Sending a message to the server in a weapon script.

PHP Code:
// The function that is triggered by triggerserver
function onActionServerSide() {

  
// The data from the triggerserver call is automatically placed into the 
  // params array.
  // It's stored like this:
  // params[0] = "message"
  // params[1] = "The actual message data"

  // Check if the first parameter is "message"
  // This is basically a minor security check, but also allows for more flexibility 
  // down the line if you send more than just messages to the server-side.
  
if (params[0] == "message") {
    
// Concates a message using the player's account and the
    // message data in params[1]
    
temp.msg player.account SPC "sent" SPC params[1];
    
// Displays the message on RC
    
sendtorc(temp.msg);
  }
}

//#CLIENTSIDE
function onCreated() {
  
// Sends a trigger to the server-side portion of this script.
  // It also passes "message" and "The actual message data" as params.
  // On the server-side the parameter data is placed into a params array.
  
triggerserver("gui"this.name"message""The actual message data");

__________________
Quote:
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 01:29 AM.


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