Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Trigger not receiving (https://forums.graalonline.com/forums/showthread.php?t=65943)

Shaun 05-09-2006 07:49 PM

Trigger not receiving
 
1 Attachment(s)
Does anybody have any idea as to why this trigger is not receiving? This is a class npc and there is another class npc that uses the same format to send/receive triggers and it does work, yet I find this one does not.

Any help would be greatly appreciated and for convenience, I have instead of just typing it out made it a colour-coded image:

Quote:

Originally Posted by Chair Script
// Chair 1 made by Shaun

function onCreated() {
this.image = "dolphonia_chair.png";
setshape(1,2,2);
drawunderplayer();
canbepushed();
canbepulled();
}
function onActionactserverside(chairfunc) {
serverr.test = "the trigger has been received!";
if (chairfunc == 1) {
setshape2(2,2,{3,3,3,3});
}
else if (chairfunc == 2) {
setshape2(2,2,{21,21,21,21});
}
else if (chairfunc == 3) {
destroy();
}
}

//#CLIENTSIDE

function onPlayerChats() {
if (player.chat == "destroy") {
chairfunc = 3;
triggeraction(x+(1/16),y+(1/16),"actserverside",chairfunc);
}
if (player.chat == "move") {
chairfunc = 2;
triggeraction(x+(1/16),y+(1/16),"actserverside",chairfunc);
}
if (player.chat == "sit") {
chairfunc = 1;
triggeraction(x+(1/16),y+(1/16),"actserverside",chairfunc);
}
}

Thanks.

Shaun 05-09-2006 08:20 PM

Ok. Suddenly when there was another player with me, the trigger started being received properly and now it works.

I don't understand how or why, but now you have a possible solution if you run into the same problem.

Skyld 05-09-2006 09:50 PM

[php] tags are probably the best for posting code with, just for future reference. Glad you sorted it, although that is slightly odd.

Shaun 05-09-2006 10:28 PM

I'm not really sure how to use php tags. The image is for looking at, and I copied and pasted the actual text in case somebody wanted to test it out on their server. For formatting large script pieces, I just run stuff through the offline script editor and press format.

Unfortunately, another piece of code isn't working. The setshape2 doesn't work (well, it works under the //#CLIENTSIDE, but I want it to work above that) if you guys have any other insight. The destroy command works, so the variable IS being sent. Just the setshape commands aren't working. Thanks again.

Angel_Light 05-09-2006 10:31 PM

setshape2 is clientside only, I believe

Shaun 05-09-2006 10:35 PM

So in order to make it so if the chair is set to sitting, everybody would sit in it, I would have to make a serversided boolean for the chair that would be triggered when a player gives a command and would be called whenever a player touches it? Seems like a bit of lag just for a single chair ;/

Angel_Light 05-09-2006 11:02 PM

lol well you could set a index with the chair so if any player touchs it it becomes "sittable"

Shaun 05-09-2006 11:10 PM

If I wanted that, I would make it sittable on creation. I want to make it kinda like Animal Crossing. The furniture can either be in movement mode or action mode. In action mode, you'd be able to sit in it. For a bed, you'd lie down in it. Etc.

Right now, the chair is a class npc that's spit out by another class npc (a lumber to chair machine). Businesses are going to buy these machines that produce various things (in exchange for raw materials of course) and produce the goods to sell to players. Smart players will be able to organize and operate the businesses while not-as-intuitive players will just be labourers working for the business, harvesting resources (lumber, minerals, etc). Couple this with a finite set of money, and this will be Graal's first economy, as far as I know.

Angel_Light 05-09-2006 11:26 PM

Sounds cool, the server I work for has a idea similiar. you could use variables

if (this.foo == 1) {
blah blah blah;
}
if (this.foo == 2) {
blah blah blah;
}

Shaun 05-09-2006 11:29 PM

I thought I already was using variables.

Angel_Light 05-09-2006 11:32 PM

*more variables, i should of said XP

ApothiX 05-10-2006 01:38 PM

You could always make two classes for 'action mode' and 'movement mode' and do something like this to switch between the two:

PHP Code:

function SwitchModes(newmode) {
  
temp.newmode newmode;

  
temp.modes = { "move""action" };

  
putnpc2(xy"join chair_" temp.modes[temp.newmode] @ ";");

  
with(npcs[npcs.size()-1]) {
    for(
temp.vnamethiso.getvarnames()) {
      
this.(@temp.vname) = thiso.(@temp.vname);
    }

     
this.currentmode temp.newmode;
  }

  
destroy();


Or something like that X_x;


All times are GMT +2. The time now is 10:03 PM.

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