Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 04-09-2013, 04:32 AM
baseman101 baseman101 is offline
Scripter
baseman101's Avatar
Join Date: Nov 2012
Location: Purcellville, VA
Posts: 76
baseman101 will become famous soon enough
My Rubbish Trivia Script (help)

I'm in the process of developing a trivia system, but please excuse my bad code. I am very new to GS2.
PHP Code:
//#CLIENTSIDE
function onCreated() {
this.+= 0.5;
}
function 
showTriviaGUI() {
new 
GuiWindowCtrl("EventTrivia_Window1") {
    
profile GuiBlueWindowProfile;
    
style $pref::Video::defaultguistyle;
    
clientrelative true;
    
clientextent "384,164";

    
canmaximize false;
    
canminimize false;
    
canmove true;
    
canclose false;
    
canresize true;
    
closequery false;
    
destroyonhide false;
    
text "Trivia";
    
288;
    
173;

    new 
GuiTextCtrl("EventTrivia_Text1") {
      
profile GuiBlueTextProfile;
      
height 20;
      
text "Please fill out the  text boxes.";
      
width 167;
      
7;
    }
    new 
GuiTextEditCtrl("EventTrivia_TextEdit1") {
      
profile GuiBlueTextEditProfile;
      
height 20;
      
width 300;
      
84;
      
37;
    }
    new 
GuiTextCtrl("EventTrivia_Text2") {
      
profile GuiBlueTextProfile;
      
height 20;
      
text "Question";
      
width 53;
      
34;
    }
    new 
GuiTextCtrl("EventTrivia_Text3") {
      
profile GuiBlueTextProfile;
      
height 20;
      
text "Answer";
      
width 42;
      
74;
    }
    new 
GuiTextEditCtrl("EventTrivia_TextEdit2") {
      
profile GuiBlueTextEditProfile;
      
height 20;
      
width 300;
      
84;
      
77;
    }
    new 
GuiButtonCtrl("EventTrivia_Button1") {
      
profile GuiBlueButtonProfile;
      
text "Submit Quesiton";
      
width 385;
      
134;
    }
  }
}

function 
onPlayerChats() {
  if (
player.chat=="/trivia" && player.guild=="Events Team") {
    
showTriviaGUI();
  }
}
function 
EventTrivia_Button1.onAction() {
  
temp.question EventTrivia_TextEdit1.text;
  
temp.answer EventTrivia_TextEdit2.text;
  
showtext(20129.511"Arial""","Last Winner");
  
setimgpart("head207.png",0,60,32,32);
  
changeimgzoom 201,.7;

Here are my questions as followed:
  1. I have a variable for the answer (temp.answer) already. I don't know how to do the rest, for finding the player's answer.
  2. I'm trying to find a way to make a string into an array, like you can in PHP with explode();. Is there a GS2 alternative?
  3. How do I set an image part, but place the image part in a certain location on the level? setimgpart() will just set the NPC's picture to the image, which I don't want.
Thanks in advanced.

Last edited by baseman101; 04-09-2013 at 04:42 AM..
Reply With Quote
 


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 02:18 PM.


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