Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Join Event (https://forums.graalonline.com/forums/showthread.php?t=87562)

Mattehy 08-22-2009 08:46 PM

Join Event
 
PHP Code:

function onActionServerside(commandacct) {
  switch (
command) {
    case 
"Host":
    
sendtorc(params[2]@" is hosting "@params[1]@"!");
    
player.chat "Hosted Event: "@params[1]@"!";
    
serverr.event params[1];
    break;
        case 
"End":
    
sendtorc(params[1]@" has ended "@serverr.event@"!");
    
player.chat "Event Ended!";
    
serverr.event "";
    break;
            case 
"Join":
    
setlevel2(this.(serverr.event@"_event")[0],this.(serverr.event@"_event")[1],this.(serverr.event@"_event")[2]);
    break;
    }
}
//#CLIENTSIDE
function onCreated()
{
this.allowevents = {"OSL"};
this.OSL_event = {"haven-osl.nw",30,30};
}
function 
onPlayerChats()
{
if(
player.chat.starts(":hostevent ")){
    
temp.tokens player.chat.tokenize();
    
temp.event temp.tokens[1];
    if(
temp.event in this.alloweventstriggerserver("gui"name"Host"temp.eventplayer.account);
    else 
player.chat "Invalid Event!";
}
if(
player.chat.starts(":endevent")){
    
temp.tokens player.chat.tokenize();
    
temp.event temp.tokens[1];
    if(
serverr.event != ""triggerserver("gui"name"End"player.account);
    else 
player.chat "Their is no event going on!";
}
if(
player.chat.starts(":joinevent")){
    if(
serverr.event != ""triggerserver("gui"name"Join");
    else 
player.chat "Their is no event going on!";
}


How would i get this to work?
i do have the rest of the script i just dont know why the setlevel2 doesnt work x.x i changed it to player.level and etc. and still doesnt work but works when i change the first thing to "haven-osl.nw" why doesnt it work with this.(serverr.event@"_event")[0].

[email protected] 08-22-2009 08:48 PM

Isn't that from Doomsday? Anyhow- we'd generally need to see the full code, as far as I can see it should work (the setlevel2).

Mattehy 08-22-2009 08:54 PM

done :D

[email protected] 08-22-2009 09:00 PM

Well, you're sending a trigger to the serverside which consists of the event name and the event hosters account. Setlevel2 consists of three params, being in this order
HTML Code:

setlevel2( "levelname.nw", positionx, positiony)
I hope this helps :)

Mattehy 08-22-2009 09:11 PM

actually i know what setlevel does and how to use it i just want to know why it doesn't work

screen_name 08-22-2009 09:16 PM

setlevel2(this.(serverr.event@"_event")[0],this.(serverr.event@"_event")[1],this.(serverr.event@"_event")[2]);

Correct me if I'm wrong, but this.(serverr.event@"_event") is this.serverr.event_event? If so, you don't have a string by that name.

Mattehy 08-22-2009 09:23 PM

doesnt matter strings dont read ()

[email protected] 08-22-2009 09:23 PM

You're calling this
triggerserver("gui", name, "Host", temp.event, player.account);

Which is setting this
serverr.event = params[1];

Which is setting basically the players first chat token...

What you could do is make a list of events, ie
HTML Code:

function onCreated() {
  this.events_list = {
    {"OSL", "Startlevel.nw", 30, 30},
    {"Fishing", "fishlevel.nw", 25, 25},
    {"spar", "Sparlevel.nw", 35, 35}
  };
}

First is your description, ie OSL, Fishing or spar. Now do the players chat

HTML Code:

if(player.chat.starts(":hostevent ")){
  temp.tokens = player.chat.tokenize();
  temp.event = temp.tokens[1];
   
  for (temp.i: this.events_list) {
    if (temp.event = temp.i[0]) {
      temp.found = temp.i;
      break;
    }
  }
  if (temp.found == false) {
    //The event isn't found!
  }
  temp.event.delete(0); //delete the event description
  triggerserver("gui", name, "Host", temp.event, player.account);
}

All you now need to say is ':hostevent spar', ':hostevent Fishing' or ':hostevent OSL'. Hope this helps.

LoneAngelIbesu 08-22-2009 09:28 PM

Quote:

Originally Posted by screen_name (Post 1517658)
Correct me if I'm wrong, but this.(serverr.event@"_event") is this.serverr.event_event? If so, you don't have a string by that name.

For example, if serverr.event was "race", the variable would be this.race_event.

Also, sid.gottlieb, please stop posting full scripts for him to use. You evidently aren't helping him.

screen_name 08-22-2009 09:30 PM

Quote:

Originally Posted by Mattehy (Post 1517662)
doesnt matter strings dont read ()

Okay, exactly what are you trying to accomplish with this.(serverr.event@"_event")??
1. Adding _event the flags value?
2. Adding _event to the actual flag name?
Either way, it's incorrect.

Andy has the better idea, even though he should listen to Ibesu.

[email protected] 08-22-2009 09:32 PM

Quote:

Originally Posted by LoneAngelIbesu (Post 1517665)
For example, if serverr.event was "race", the variable would be this.race_event.

Also, sid.gottlieb, please stop posting full scripts for him to use. You evidently aren't helping him.


He's got most of the script, I'm giving him advice on how I'd do it and It's his choice to use it or not. I'm not giving him the full script, as you can see I was giving him an alternative method.

Mattehy 08-22-2009 09:36 PM

that works nicely :D thanks but still has solved my question about the setlevel2 :/
i was asking why doesnt it doesnt work with the
PHP Code:

this.(serverr.event@"_event")[0

that was my question nothing about the :hostevent command but it was good help :D
and how would it work with
PHP Code:

  this.events_list = {
    {
"OSL""haven-osl.nw"3030}
  }; 


xXziroXx 08-22-2009 09:43 PM

Change
PHP Code:

this.(serverr.event@"_event")[0

to
PHP Code:

this.(@serverr.event@"_event")[0


Mattehy 08-22-2009 09:51 PM

with
PHP Code:

  this.events_list = {
    {
"OSL""haven-osl.nw"3030}
  }; 

it would be
PHP Code:

setlevel2(this.event_list[1],this.event_list[2],this.event_list[3]); 

but how would i choose that its OSL not another event?

[email protected] 08-22-2009 09:56 PM

xXZiroXx is correct- just copy&paste it to your code :)


All times are GMT +2. The time now is 12:03 AM.

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