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 03-19-2011, 05:43 AM
devilsknite1 devilsknite1 is offline
C:
devilsknite1's Avatar
Join Date: Jul 2006
Location: Florida, USA
Posts: 269
devilsknite1 has a spectacular aura about
Send a message via AIM to devilsknite1 Send a message via MSN to devilsknite1 Send a message via Yahoo to devilsknite1
Youtube GuiFlash Player

Pretty straight forward. I used born2kill's flash player as a base; it can be found at http://forums.graalonline.com/forums...hp?t=134260372. Kind of glitchy as of right now, I'll fix it up when I have time. The only known glitch so far is the fact that you sometimes need to try twice to get the video to load, or just wait an extremely long time upon the first attempt if nothing pops up instantly. Dunno, just thought it would be kind of fun to mess around with it since I didn't see it anywhere else on the forums. If any other in-game GUIs are over it, it will not display the youtube player. It also downloads files for the autoplay feature, but that can be removed as it isn't really that necessary. Sadly there are only chat commands to destroy GUIs in case of freezing or to just get rid of the video. Haven't bothered adding any conveniences to it yet.

Video tag I used to test:
Op7yi9wzR5I (it's not a rick roll............. -_- see screen shots for what the video actually is, if you're that concerned)

PHP Code:
function onActionServerSideafiaccsvar ) {
  switch( 
afi ) {
    case 
"others": {
      
temp.findPlayerByCommunityNameacc ); // Receiving account
      
temp.svar// Youtube tag
      
if ( player.account == temp.) {
        
player.chat "Well, that just doesn't make any sense, does it?";
      }
      if ( 
temp.!= NULL ) {
        
temp.r.triggerClient"gui"name"acceptance"player.accounttemp.);
      } else {
        
triggerClient"gui"name"negative"temp.);
      }
      break;
    }
  }
}

//#CLIENTSIDE

function onActionClientSideafisvarsvar2 ) {
  switch( 
afi ) {
    case 
"acceptance": {
      
player.chat svar SPC "has requested that you watch a video!";
      
onAcceptanceGUIsvarsvar2 );
      break;
    }
    case 
"negative": {
      
player.chat "The player you have requested (" svar ") was not found!";
      break;
    }
  }
}

function 
onWeaponFired() {
  
say2"/youtube <- Opens options" NL
  
"/options <- In case the window" NL
  
"freezes, this will remove it" NL
  
"/video <- removes the video from" NL
  
"your screen" NL
  
"/acceptance <- In case the window" NL
  
"freezes, this will remove it" );
}

function 
onPlayerChats() {
  if ( 
player.chat == "/youtube" ) {
    
onOpenOptionsGUI();
    
player.chat "Youtube options opened!";
  }
  if ( 
player.chat == "/options" && Options_Window1.visible ) {
    
Options_Window1.destroy();
  }
  if ( 
player.chat == "/video" && Youtube_Video.visible ) {
    
Youtube_Video.destroy();
  }
  if ( 
player.chat == "/acceptance" && Acceptance_Window1.visible ) {
    
Acceptance_Window1.destroy();
  }
}

function 
onOpenOptionsGUI() {
  new 
GuiWindowCtrl"Options_Window1" ) {
    
profile GuiBlueWindowProfile;
    
clientRelative true;
    
clientExtent "265,185";
    
canClose true;
    
canMaximize false;
    
canMove true;
    
canResize false;
    
closeQuery false;
    
destroyOnHide true;
    
text "Youtube Options Window";
    
screenwidth - ( width );
    
screenheight - ( height );

    new 
GuiScrollCtrl"Options_MultiLine1_Scroll" ) {
      
profile GuiBlueScrollProfile;
      
height 185;
      
hScrollBar "dynamic";
      
vScrollBar "dynamic";
      
width 143;

      new 
GuiMLTextCtrl"Options_MultiLine1" ) {
        
profile GuiBlueMLTextProfile;
        
height 192;
        
horizSizing "width";
        
htmlCompatibility true;
        
text "<center><b>Instructions</b><br><br>Enter the \"tag\" (fo0baR3a1 and nothing else) into the provided area. If you'd like to send this video to another player, click \"yes\" and type the community name of the player in the space provided.";
        
width 118;
      }
    }
    
    new 
GuiTextEditCtrl"Options_TextEdit1" ) {
      
profile GuiBlueTextEditProfile;
      
height 20;
      
width 114;
      
146;
      
19;
    }
    
    new 
GuiTextCtrl"Options_Text1" ) {
      
profile GuiBlueTextProfile;
      
profile.fontColor "black";
      
height 20;
      
text "Youtube Tag";
      
width 70;
      
165;
    }
    
    new 
GuiTextCtrl"Options_Text2" ) {
      
profile GuiBlueTextProfile;
      
profile.fontColor "black";
      
height 20;
      
text "Send to another player?";
      
width 116;
      
147;
      
56;
    }
    
    new 
GuiTextEditCtrl"Options_TextEdit2" ) {
      
profile GuiBlueTextEditProfile;
      
height 20;
      
width 114;
      
146;
      
116;
    }
    
    new 
GuiCheckBoxCtrl"Options_CheckBox1" ) {
      
profile GuiBlueCheckBoxProfile;
      
height 20;
      
text "Yes";
      
width 36;
      
147;
      
77;
      
thiso.catchEventthis"onMouseUp""onCheckYes" );
    }
    
    new 
GuiCheckBoxCtrl"Options_CheckBox2" ) {
      
profile GuiBlueCheckBoxProfile;
      
height 20;
      
text "No";
      
width 30;
      
215;
      
77;
      
thiso.catchEventthis"onMouseUp""onCheckNo" );
    }
    
    new 
GuiTextCtrl"Options_Text3" ) {
      
profile GuiBlueTextProfile;
      
profile.fontColor "black";
      
height 20;
      
text "Account name:";
      
width 73;
      
163;
      
97;
    }
    
    new 
GuiButtonCtrl"Options_Button1" ) {
      
profile GuiBlueButtonProfile;
      
height 24;
      
text "Go!";
      
width 80;
      
159;
      
136;
    }
    
    new 
GuiButtonCtrl"Options_Button2" ) {
      
profile GuiBlueButtonProfile;
      
height 24;
      
text "Cancel";
      
width 80;
      
159;
      
161;
    }
  }
  
Options_CheckBox2.checked true;
  
Options_TextEdit2.active false;
}

function 
Options_Button1.onAction() {
  if ( 
Options_CheckBox2.checked == true ) {
    
onOpenFlashGUIOptions_TextEdit1.text );
    
sleep);
    
Options_Window1.destroy();
  }
  if ( 
Options_CheckBox2.checked == false ) {
    if ( 
Options_TextEdit2.text != "" ) {
      if ( 
Options_TextEdit2.text != "Please enter an account name!" ) {
        
triggerServer"gui"name"others"Options_TextEdit2.textOptions_TextEdit1.text );
        
onOpenFlashGUIOptions_TextEdit1.text );
        
sleep);
        
Options_Window1.destroy();
      }
    } else {
      
Options_TextEdit2.text "Please enter an account name!";
    }
  }
}

function 
Options_Button2.onAction() {
  
Options_Window1.destroy();
}

function 
onCheckYes() {
  
Options_CheckBox1.checked true;
  
Options_TextEdit2.active true;
  
Options_CheckBox2.checked false;
}

function 
onCheckNo() {
  
Options_CheckBox2.checked true;
  
Options_TextEdit2.active false;
  
Options_CheckBox1.checked false;
}

function 
onAcceptanceGUIsvarsvar2 ) {
  new 
GuiWindowCtrl"Acceptance_Window1" ) {
    
profile GuiBlueWindowProfile;
    
clientRelative true;
    
clientExtent "320,59";
    
canClose true;
    
canMaximize false;
    
canMove true;
    
canResize false;
    
closeQuery false;
    
destroyOnHide true;
    
text "Video Request!";
    
screenwidth - ( width );
    
screenheight - ( height );

    new 
GuiTextCtrl"Acceptance_Text1" ) {
      
profile GuiBlueTextProfile;
      
profile.fontColor "black";
      
height 20;
      
text svar SPC "would like you to watch a video";
      
width 234;
      
14;
      
4;
    }
    
    new 
GuiTextCtrl"Acceptance_Text2" ) {
      
profile GuiBlueTextProfile;
      
profile.fontColor "black";
      
height 20;
      
text svar2;
      
width 100;
      
220;
      
4;
    }
    
    new 
GuiButtonCtrl"Acceptance_Button1" ) {
      
profile GuiBlueButtonProfile;
      
text "Accept";
      
width 80;
      
14;
      
29;
    }
    
    new 
GuiButtonCtrl"Acceptance_Button2" ) {
      
profile GuiBlueButtonProfile;
      
text "Decline";
      
width 80;
      
226;
      
29;
    }
  }
}

function 
Acceptance_Button1.onAction() {
  
player.chat Acceptance_Text2.text;
  
onOpenFlashGUIAcceptance_Text2.text );
  
sleep);
  
Acceptance_Window1.destroy();
}

function 
Acceptance_Button2.onAction() {
  
Acceptance_Window1.destroy();
}

function 
onOpenFlashGUIsvar ) {
  new 
GuiFlash"Youtube_Video" ) {
    
width 768;
    
height 432;
    
screenwidth - ( width );
    
screenheight - ( height );
    
requiresActiveX false;
    
requiresPlugin false;
    
tryActiveX true;
    
tryPlugin true;
    
loopMovie false;
    
downloadWebFiles true;
    
movieName "http://www.youtube.com/v/" svar "&autoplay=1";
  }
  
  new 
GuiFlash"Youtube_Loader" ) {
    
Youtube_Video.x;
    
Youtube_Movie.y;
    
width Youtube_Movie.width;
    
height Youtube_Movie.height;
    
requiresActiveX false;
    
requiresPlugin false;
    
tryActiveX true;
    
tryPlugin true;
    
loopMovie false;
    
downloadWebFiles true;
    
moviename "";
  }
  
sleep);
  
Youtube_Loader.destroy();

Added default closing of GUIs along with the cancel button.
Removed the players account from triggers.
Attached Thumbnails
Click image for larger version

Name:	screenie1.png
Views:	265
Size:	33.8 KB
ID:	52567   Click image for larger version

Name:	screenie2.png
Views:	269
Size:	23.9 KB
ID:	52568   Click image for larger version

Name:	screenie3.png
Views:	281
Size:	17.3 KB
ID:	52569  

Last edited by devilsknite1; 03-20-2011 at 03:16 AM.. Reason: Script edit
Reply With Quote
  #2  
Old 03-19-2011, 06:21 AM
nullify nullify is offline
Registerd Abuser
nullify's Avatar
Join Date: May 2004
Location: The cheese state.
Posts: 851
nullify has a spectacular aura about
Never gonna give you up...
Reply With Quote
  #3  
Old 03-19-2011, 06:36 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
There is no absolutely no reason to send your own account along with a trigger. All it does it open up the possibility for a memory editor to change their own account on clientside, which would allow you to send requests that look like they're from a different user.

Also, why not use GuiRadioCtrl instead of makeshift radio buttons using check boxes?

You should also enable closing the window. It's confusing from a UI perspective when you have to click a "Cancel" button instead of clicking the normal "x".

Nice work though, it's quite interesting.
__________________
Reply With Quote
  #4  
Old 03-20-2011, 02:08 AM
devilsknite1 devilsknite1 is offline
C:
devilsknite1's Avatar
Join Date: Jul 2006
Location: Florida, USA
Posts: 269
devilsknite1 has a spectacular aura about
Send a message via AIM to devilsknite1 Send a message via MSN to devilsknite1 Send a message via Yahoo to devilsknite1
Quote:
Originally Posted by cbk1994 View Post
There is no absolutely no reason to send your own account along with a trigger. All it does it open up the possibility for a memory editor to change their own account on clientside, which would allow you to send requests that look like they're from a different user.

Also, why not use GuiRadioCtrl instead of makeshift radio buttons using check boxes?

You should also enable closing the window. It's confusing from a UI perspective when you have to click a "Cancel" button instead of clicking the normal "x".

Nice work though, it's quite interesting.
- This is true, but for some reason it really didn't like it when I didn't send the players account along with the trigger; it was mainly for debugging purposes. Removed.

- Eh, I just like the boxes versus the circles. Not really affecting anything from a functionality standpoint, so not going to really bother with that one, but will keep it in mind for other GUIs.

- Agreed. Changed.
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:25 AM.


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