Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-02-2007, 04:54 AM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
GlobalMsg - Client for Global Messaging System

Client Messaging System
Version: 0.6.3b
for Global Message/Event System (by Ziro and Joey)
by rapidwolve

PHP Code:
/* 
Febuary 1st, 2007 
by Rapidwolve 
Version: 0.6.3b 
For EventsBot => v4.10   

Included: 
  +>> Basic Functions 
  +>> Options 

Next Release: 
  +>> No need for quotes 
  +>> Serverlists for PM function 
  +>> No Quotes 
  +>> Working Options 
  +>> PM Function 
   
Help: 
  +>> To answer trivia questions say /trivia # 
  +>> To clear console text say /clear 
  +>> Use quotes (e.g "Testing Script") 

*/ 

//#CLIENTSIDE
function onCreated() { 
  
requesttext("clientrc"1); 


function 
onKeyPressed(codekey) { 
  if (
key == "c") { 
    
openWin(); 
    } 


public function 
openWin() { 

  new 
GuiWindowCtrl("GlobalMsg_Console-MainWin") { 
    
profile "GuiBlueWindowProfile"
    
visible true
    
extent = {550380}; 
    
canClose canMaximize canResize false

    
thiso.buttons = { 
    
"PM"
    
"Options"
    
"Close"}; 
    
thiso.buttonspos = {406453500}; 

    for (
0thiso.buttons.size(); i++) { 
      new 
GuiButtonCtrl("GlobalMsg_Button_" thiso.buttons[i]) { 
        
profile "GuiBlueButtonProfile"
        
text thiso.buttons[i]; 
        
thiso.buttonspos[i][0]; 
        
353
        
extent = {4521}; 
        
thiso.catchevent(name"onAction""onClicked"); 
      } 
    } 

    new 
GuiScrollCtrl("GlobalMsg_Console-Scroll1") { 
      
hScrollBar "alwaysOff"
      
vScrollBar "dynamic"
      
position = {622}; 
      
profile "GuiBlueScrollProfile"
      
extent = {400330}; 


      new 
GuiMLTextCtrl("GlobalMsg_Console-Text") { 
        
position = {20}; 
        
profile "GuiBlueMLTextProfile"
        
extent = {33010}; 
        if (
text == null
          
text "Scripted by RW*"
      } 
    } 

    new 
GuiScrollCtrl("GlobalMsg_Console-Scroll2") { 
      
hscrollbar "alwaysOff"
      
vscrollbar "dynamic"
      
profile "GuiBlueScrollProfile"
      
position = {40622}; 
      
extent = {137330}; 

    } 

    new 
GuiTextEditCtrl("GlobalMsg_Console-TextEdit1") { 
      
profile "GuiBlueTextEditProfile"
      
position = {6352}; 
      
extent = {40022}; 
      
thiso.catchevent(name"onAction""sendMsg"); 
      
historySize 100
    } 
  } 



function 
sendMsg(texteditmessage) { 
  
tok message.tokenize(); 
  
textedit.text ""
  if (
tok[0].starts("/trivia")) { 
    
sendtorc("/npctrivia" SPC tok[1]); 
  } 
  if (
tok[0] == "/clear") { 
    (
"GlobalMsg_Console-Text").text "Scripted by RW*"
  } 
  if (!
tok[0].starts("/")) { 
    
sendtorc("/npcglobalmsg" SPC message); 
    
player.chat message
  } 


function 
onRCChat(message) { 
  
temp.starts = { 
                  
"[ Trivia Bot ]"
                  
"Global Message sent successfully by"
                  
"Global Message from"
                }; 
  if (
message.starts(temp.starts[0]) || message.starts(temp.starts[1]) || message.starts(temp.starts[2])) { 

    
normalcolor "limegreen"
    
tcolon message.pos(":"); 
    
nmessage "<font color="@normalcolor@"><b>"
    
nmessage @= message.substring(0tcolon 1) @ "</font></b>" message.substring(tcolon 1, -1); 
    (
"GlobalMsg_Console-Text").addText("\n" nmessagetrue); 
    (
"GlobalMsg_Console-Text").scrolltobottom(); 
  } 



function 
onClicked(btn) { 
  
temp.btn btn.substring(17); 

  if (
temp.btn == "Close") { 
    
onCloseAll(); 
  } 

  if (
temp.btn == "Options") { 
    
openOptionsWin(); 
  } 

  if (
temp.btn == "PM") { 
    
openPMWin(); 
  } 


function 
onCloseAll() { 
  (
"GlobalMsg_OptionsWin").destroy(); 
  (
"GlobalMsg_Console-MainWin").destroy(); 


function 
onClose(win) { 
  
win.parent.destroy(); 


function 
SaveandClose(win) { 
  
temp.option.privatemessaging = ("Option_privatemessaging").checked
  
temp.option.triviabot = ("Option_triviabot").checked
  
temp.option.saveVars("options/globalmsg.txt"0); 
  
onClose(win); 


function 
openOptionsWin() { 
  new 
GuiWindowCtrl("GlobalMsg_OptionsWin") { 
    
visible true
    
profile "GuiBlueWindowProfile"
    
extent = {250250}; 
    
position = {500300}; 
    
canMaximize canMinimize canResize false
    
title true
    
text "Options"

    new 
GuiScrollCtrl("GlobalMsg_OptionsScrl") { 
      
position = {623}; 
      
extent = {238200}; 
      
profile "GuiBlueScrollProfile"
      
hScrollBar vScrollBar "alwaysOff"

      
thiso.eoptions = {"triviabot""privatemessaging"}; 
      
thiso.optionspos = {1035}; 
      
thiso.option.loadVars("options/globalmsg.txt"); 


      for (
0thiso.eoptions.size(); j++) { 
        new 
GuiCheckBoxCtrl("Option_" thiso.eoptions[j]) { 
          
profile "GuiBlueCheckBoxProfile"
          
text " " thiso.eoptions[j]; 
          
6
          
thiso.optionspos[j]; 
          
checked makevar("thiso.option." thiso.eoptions[j]); 
        } 
      } 

    } 

    new 
GuiButtonCtrl("GlobalMsg_OptionsBtn-SavenClose") { 
      
profile "GuiBlueButtonProfile"
      
extent = {6221}; 
      
position = {56223}; 
      
text "Save & Exit"
      
thiso.catchevent(name"onAction""SaveandClose"); 
    } 

    new 
GuiButtonCtrl("GlobalMsg_OptionsBtn-Close") { 
      
profile "GuiBlueButtonProfile"
      
extent = {6021}; 
      
position = {126223}; 
      
text "E x i t"
      
thiso.catchevent(name"onAction""onClose"); 
    } 
  } 

Note: This is a very quick script I made so you can GlobalChat on Client instead of being on RC. You do not require to type /npc globalmsg "text", but you do need to use quotes (this is because of the way the message system is made).

Read comments on top of script for information and help. I don't plan on releasing again until its completely done and modular for easy updates. Enjoy for now.
Reply With Quote
  #2  
Old 02-02-2007, 04:58 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Harr harr, more "mods" for the message sys! Nice work.
__________________
Follow my work on social media post-Graal:Updated august 2025.
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:26 PM.


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