| baseman101 |
05-23-2013 03:05 AM |
Hey, thanks for your consideration! I've done some triggers once I've got a hold of them, and here's my current code. The current problem is that it doesn't resister if someone wins. I know the variable gets sent, because I've added this.chat=temp.answer previously from serverside. Also, I'm going to add the tokenize function later once I get the main idea down. Sorry, I've tried looking for scripting resources, but no ado. Thank you!
PHP Code:
function onCreated() { setshape( 1, 32, 32 ); setimg( "zoneiphone_tv.png" ); }
function onActionTrivia(temp.question,temp.answer) { showtext(198, 21.6, 17.5, "Arial", "","Q: " @ temp.question); changeimgzoom 198,.8; onTimeout(temp.answer); //calls the timeout function with the temp.answer variable } function onTimeout(temp.answer) { for(temp.pl : allplayers) { //gets player in the level if(temp.pl.level.name != "zone_event-trivia.nw") continue; //doesn't count players outside this level if(temp.pl == temp.answer) { //checks if someone wins the event showtext(198, 21.6, 17.5, "Arial", "",temp.pl.nick @ " has won!"); } } setTimer(0.5); //loops it } //#CLIENTSIDE function onPlayerChats() { if (player.chat=="/trivia" && player.guild=="Events Team") { showTriviaGUI(); } } 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"; x = 288; y = 173; new GuiTextCtrl("EventTrivia_Text1") { profile = GuiBlueTextProfile; height = 20; text = "Please fill out the text boxes."; width = 167; x = 7; } new GuiTextEditCtrl("EventTrivia_TextEdit1") { profile = GuiBlueTextEditProfile; height = 20; width = 300; x = 84; y = 37; } new GuiTextCtrl("EventTrivia_Text2") { profile = GuiBlueTextProfile; height = 20; text = "Question"; width = 53; y = 34; } new GuiTextCtrl("EventTrivia_Text3") { profile = GuiBlueTextProfile; height = 20; text = "Answer"; width = 42; y = 74; } new GuiTextEditCtrl("EventTrivia_TextEdit2") { profile = GuiBlueTextEditProfile; height = 20; width = 300; x = 84; y = 77; } new GuiButtonCtrl("EventTrivia_Button1") { profile = GuiBlueButtonProfile; text = "Submit Quesiton"; width = 385; y = 134; } } } function EventTrivia_Button1.onAction() { temp.question = EventTrivia_TextEdit1.text; temp.answer = EventTrivia_TextEdit2.text; EventTrivia_Window1.destroy(); temp.x = (GraalControl.width - width) / 2; //attempt to make the trivia box half of the screen width. help please? triggeraction(this.x,this.y,"Trivia",temp.question,temp.answer); //triggers the server }
|