Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-22-2009, 08:46 PM
Mattehy Mattehy is offline
Developer
Mattehy's Avatar
Join Date: Jul 2009
Posts: 58
Mattehy is on a distinguished road
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].
__________________
Develop 4 Lyf

Last edited by Mattehy; 08-22-2009 at 08:53 PM.. Reason: giving full code
Reply With Quote
  #2  
Old 08-22-2009, 08:48 PM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
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).
Reply With Quote
  #3  
Old 08-22-2009, 08:54 PM
Mattehy Mattehy is offline
Developer
Mattehy's Avatar
Join Date: Jul 2009
Posts: 58
Mattehy is on a distinguished road
done
__________________
Develop 4 Lyf
Reply With Quote
  #4  
Old 08-22-2009, 09:00 PM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
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
Reply With Quote
  #5  
Old 08-22-2009, 09:11 PM
Mattehy Mattehy is offline
Developer
Mattehy's Avatar
Join Date: Jul 2009
Posts: 58
Mattehy is on a distinguished road
actually i know what setlevel does and how to use it i just want to know why it doesn't work
__________________
Develop 4 Lyf
Reply With Quote
  #6  
Old 08-22-2009, 09:16 PM
screen_name screen_name is offline
is watching you
Join Date: Mar 2002
Location: The 3rd Dimension
Posts: 2,160
screen_name is on a distinguished road
Send a message via AIM to screen_name Send a message via MSN to screen_name
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.
__________________
[signature]insert here[/signature]
Reply With Quote
  #7  
Old 08-22-2009, 09:23 PM
Mattehy Mattehy is offline
Developer
Mattehy's Avatar
Join Date: Jul 2009
Posts: 58
Mattehy is on a distinguished road
doesnt matter strings dont read ()
__________________
Develop 4 Lyf
Reply With Quote
  #8  
Old 08-22-2009, 09:23 PM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
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.
Reply With Quote
  #9  
Old 08-22-2009, 09:28 PM
LoneAngelIbesu LoneAngelIbesu is offline
master of infinite loops
LoneAngelIbesu's Avatar
Join Date: May 2007
Location: Toldeo, Ohio
Posts: 1,049
LoneAngelIbesu has a spectacular aura aboutLoneAngelIbesu has a spectacular aura about
Send a message via AIM to LoneAngelIbesu
Quote:
Originally Posted by screen_name View Post
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.
__________________
"We are all in the gutter, but some of us are looking at the stars."
— Oscar Wilde, Lady Windermere's Fan
Reply With Quote
  #10  
Old 08-22-2009, 09:30 PM
screen_name screen_name is offline
is watching you
Join Date: Mar 2002
Location: The 3rd Dimension
Posts: 2,160
screen_name is on a distinguished road
Send a message via AIM to screen_name Send a message via MSN to screen_name
Quote:
Originally Posted by Mattehy View Post
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.
__________________
[signature]insert here[/signature]
Reply With Quote
  #11  
Old 08-22-2009, 09:32 PM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
Quote:
Originally Posted by LoneAngelIbesu View Post
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.
Reply With Quote
  #12  
Old 08-22-2009, 09:36 PM
Mattehy Mattehy is offline
Developer
Mattehy's Avatar
Join Date: Jul 2009
Posts: 58
Mattehy is on a distinguished road
that works nicely 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
and how would it work with
PHP Code:
  this.events_list = {
    {
"OSL""haven-osl.nw"3030}
  }; 
__________________
Develop 4 Lyf
Reply With Quote
  #13  
Old 08-22-2009, 09:43 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Change
PHP Code:
this.(serverr.event@"_event")[0
to
PHP Code:
this.(@serverr.event@"_event")[0
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #14  
Old 08-22-2009, 09:51 PM
Mattehy Mattehy is offline
Developer
Mattehy's Avatar
Join Date: Jul 2009
Posts: 58
Mattehy is on a distinguished road
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?
__________________
Develop 4 Lyf
Reply With Quote
  #15  
Old 08-22-2009, 09:56 PM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
xXZiroXx is correct- just copy&paste it to your code
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 11:39 AM.


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