Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   GlobalMsg - Client for Global Messaging System (https://forums.graalonline.com/forums/showthread.php?t=71883)

Rapidwolve 02-02-2007 04:54 AM

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.

xXziroXx 02-02-2007 04:58 AM

Harr harr, more "mods" for the message sys! Nice work.


All times are GMT +2. The time now is 07:07 PM.

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