Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-16-2009, 09:48 AM
Cubes Cubes is offline
Registered User
Cubes's Avatar
Join Date: Dec 2005
Location: Chesapeake, Virginia
Posts: 498
Cubes is a jewel in the roughCubes is a jewel in the rough
Sending multiple trigger actions

Is it possible to send multiple trigger actions to the same thing? This is just an example of what i'm mean by sending from client->serverside. It is only doing the first one I try to send.

PHP Code:
function onKeyPressed(keycodecharscancode) {
  if(
keycode == 192) {
    
triggerserver("gui""-loltest""flip"1);     
    
triggerserver("gui""-loltest""flip"2);    
    
triggerserver("gui""-loltest""flip"3);    
  }

Reply With Quote
  #2  
Old 06-16-2009, 09:49 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Yes, it should work fine. I don't know why it isn't for you.
__________________
Reply With Quote
  #3  
Old 06-16-2009, 09:49 AM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
send 1, 2, 3 as an array instead of having 3 triggers.
__________________
Reply With Quote
  #4  
Old 06-16-2009, 09:53 AM
Cubes Cubes is offline
Registered User
Cubes's Avatar
Join Date: Dec 2005
Location: Chesapeake, Virginia
Posts: 498
Cubes is a jewel in the roughCubes is a jewel in the rough
I got it to work but i had to put sleeps between each one, any suggestions on something to prevent the delay? @chompy its not really like that it has more than one param, the code i posted was just an example of what i meant.
edit: i'm retarded and had a typo ;[ works now.
Reply With Quote
  #5  
Old 06-16-2009, 10:34 AM
Pelikano Pelikano is offline
Registered User
Pelikano's Avatar
Join Date: Oct 2008
Posts: 1,133
Pelikano has a little shameless behaviour in the past
You can also loop if you want it to look kewl D:
Reply With Quote
  #6  
Old 06-16-2009, 06:29 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Quote:
Originally Posted by Cubes View Post
@chompy its not really like that it has more than one param, the code i posted was just an example of what i meant.

That still doesn't mean that you should be sending so many triggers to the same action so consecutively--use arrays. If you don't want to clutter the trigger command then set up temp. vars that store the information for you and send the temp. vars over as the params to make it look cleaner.
Reply With Quote
  #7  
Old 06-16-2009, 07:12 PM
Cubes Cubes is offline
Registered User
Cubes's Avatar
Join Date: Dec 2005
Location: Chesapeake, Virginia
Posts: 498
Cubes is a jewel in the roughCubes is a jewel in the rough
So I should do it like this?
PHP Code:
triggerserver("gui""-loltest""flip", {1,2,3}); 
or like this

PHP Code:
temp.= {1,2,3}
triggerserver("gui""-loltest""flip"temp.i); 
Reply With Quote
  #8  
Old 06-16-2009, 07:17 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
top
Reply With Quote
  #9  
Old 06-17-2009, 08:43 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Quote:
Originally Posted by Cubes View Post
So I should do it like this?
PHP Code:
triggerserver("gui""-loltest""flip", {1,2,3}); 
or like this

PHP Code:
temp.= {1,2,3}
triggerserver("gui""-loltest""flip"temp.i); 

Depends on the length of the array, if it really is just 3 numbers then save the extra line and just send the trigger using {1,2,3}, but if it's a rather large string array of some sort then it would be better to use a temp. var.
Reply With Quote
  #10  
Old 06-17-2009, 08:48 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Gambet View Post
Depends on the length of the array, if it really is just 3 numbers then save the extra line and just send the trigger using {1,2,3}, but if it's a rather large string array of some sort then it would be better to use a temp. var.
It's really personal preference. Some people always stick things in a variable, even if they only plan to use it once and could have inserted it there. Others always put it directly in the function.
__________________
Reply With Quote
  #11  
Old 06-25-2009, 06:05 AM
Ronnie Ronnie is offline
Registered User
Join Date: Jun 2008
Location: Nj, USA
Posts: 48
Ronnie is on a distinguished road
Send a message via AIM to Ronnie
Is -loltest , the name of the weapon?
Reply With Quote
  #12  
Old 06-25-2009, 06:42 AM
salesman salesman is offline
Finger lickin' good.
salesman's Avatar
Join Date: Nov 2008
Location: Colorado
Posts: 1,865
salesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud of
Quote:
Originally Posted by Ronnie View Post
Is -loltest , the name of the weapon?
Yes.
Reply With Quote
  #13  
Old 06-25-2009, 06:42 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by Ronnie View Post
Is -loltest , the name of the weapon?
In the example above yes it would be, and here's some usage of triggerserver.

PHP Code:
// Weapon Name: -loltest
function onActionServerSide() {
  echo(
"i luld " params[0]);
}
//#CLIENTSIDE
function onCreated() {
  
triggerserver("gui""-loltest""lolparam");
  
// Alternatively you can do..
  
triggerserver("gui"this.name"lolparam");

Edit: Looks like salesman was a few seconds earlier than I was..
__________________
Quote:
Reply With Quote
  #14  
Old 06-25-2009, 10:04 PM
Paradoxical Paradoxical is offline
Professional Programmer
Join Date: Jun 2009
Posts: 10
Paradoxical is on a distinguished road
Send a message via AIM to Paradoxical Send a message via MSN to Paradoxical
Quote:
Originally Posted by Gambet View Post
That still doesn't mean that you should be sending so many triggers to the same action so consecutively--use arrays. If you don't want to clutter the trigger command then set up temp. vars that store the information for you and send the temp. vars over as the params to make it look cleaner.
Yeah, save some bandwidth and don't send un-nessisary data between client and server, hell, you could even cache all the data you need on the client, and then do a verification check on the server here and there to check for unauthorized changing of clientsided data, but that's a bit extremist.
__________________
-Zachary Trant


"In the middle of difficulty, lies oppertunity."
-Albert Einstein
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 02:33 PM.


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