Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Future Improvements (https://forums.graalonline.com/forums/forumdisplay.php?f=10)
-   -   function onActionRConline () (https://forums.graalonline.com/forums/showthread.php?t=79259)

Pimmeh 03-31-2008 12:20 PM

function onActionRConline ()
 
Why isnt this command in existance?
I always wanted an RC startup message seperated from the player one!
Can someone tell me a way how to do this?

Crow 03-31-2008 02:47 PM

Check if the player.level.name is NULL when somebody logs on (do that serverside, in the Control-NPC or w/e). If thats the case, its an RC.

cbk1994 03-31-2008 06:06 PM

onActionPlayerOnline doesn't work for RCs I am fairly certain--you'd have to make a loop

Crow 03-31-2008 07:14 PM

Hm, not sure. It's done on Era somehow, but I'm too lazy to check right now D:

Tigairius 03-31-2008 07:35 PM

Quote:

Originally Posted by Crow (Post 1383382)
Hm, not sure. It's done on Era somehow, but I'm too lazy to check right now D:

It's a 1-3 second loop in a DBNPC that checks allplayers

PHP Code:

function onCreated() {
  
onTimeout();
}

function 
onTimeout() {
  for (
temp.playerallplayers) {
    if (
temp.player.head != "tig-rchead2.png" && temp.player.level.name == NULL) {
      
temp.player.head "tig-rchead2.png";
      
this.onRCLogin(temp.player.link());
    }
  }
  
setTimer(2);
}

function 
onRCLogin(pl) {
  
pl.sendpm("Hello new RC.");



Crow 03-31-2008 07:48 PM

Quote:

Originally Posted by Tigairius (Post 1383385)
It's a 1-3 second loop in a DBNPC that checks allplayers

PHP Code:

function onCreated() {
  
onTimeout();
}

function 
onTimeout() {
  for (
temp.playerallplayers) {
    if (
temp.player.head != "tig-rchead2.png" && temp.player.level.name == NULL) {
      
temp.player.head "tig-rchead2.png";
      
this.onRCLogin(temp.player.link());
    }
  }
  
setTimer(2);
}

function 
onRCLogin(pl) {
  
pl.sendpm("Hello new RC.");



Ah ;D

Rapidwolve24 04-01-2008 12:18 AM

Quote:

Originally Posted by Tigairius (Post 1383385)
It's a 1-3 second loop in a DBNPC that checks allplayers

PHP Code:

function onCreated() {
  
onTimeout();
}

function 
onTimeout() {
  for (
temp.playerallplayers) {
    if (
temp.player.head != "tig-rchead2.png" && temp.player.level.name == NULL) {
      
temp.player.head "tig-rchead2.png";
      
this.onRCLogin(temp.player.link());
    }
  }
  
setTimer(2);
}

function 
onRCLogin(pl) {
  
pl.sendpm("Hello new RC.");



What the hell is link()?

Tigairius 04-01-2008 12:33 AM

Quote:

Originally Posted by Rapidwolve24 (Post 1383433)
What the hell is link()?

object.link() - It's basically the account name.

Tolnaftate2004 04-01-2008 01:30 AM

Quote:

Originally Posted by Tigairius (Post 1383434)
object.link() - It's basically the account name.

Good guess, it actually makes a pointer to a variable, i.e., linking two variables to the same address.

Tigairius 04-01-2008 01:39 AM

Quote:

Originally Posted by Tolnaftate2004 (Post 1383436)
Good guess, it actually makes a pointer to a variable, i.e., linking two variables to the same address.

:) Thanks.

Inverness 04-01-2008 02:13 AM

variable.link() does nothing except returning the variable's value.

Instead of sending temp.player.link() you would just send temp.player as that is an object. And object variables are pointers.

Skyld 04-01-2008 09:43 AM

Quote:

Originally Posted by Inverness (Post 1383444)
variable.link() does nothing except returning the variable's value..

Internally speaking, obj.link() returns a pointer which is referenced later instead of being sent through the callstack as a plain value. It doesn't have a great amount of use in GScript, but it doesn't just return the variable's value.

Admins 04-01-2008 11:01 AM

obj.link() can be used to pass huge arrays to functions without copying the array (by default it's copying the variable except it's already a link to an object). Also the called function can modify the original array that way.

Inverness 04-01-2008 01:00 PM

Ugh, I'd really like it if you would DOCUMENT these things -.-

Admins 04-01-2008 02:01 PM

I've already told you this one year ago :D http://forums.graalonline.com/forums...ad.php?t=71633

Crow 04-01-2008 04:02 PM

I'm all for a super leet wiki entry called "Uber Rox0r functions people dont know **** about" that lists stuff like that ;D

cbk1994 04-01-2008 11:08 PM

Quote:

Originally Posted by Stefan (Post 1383499)
I've already told you this one year ago :D http://forums.graalonline.com/forums...ad.php?t=71633

LOL

Inverness 04-02-2008 12:13 AM

Quote:

Originally Posted by Stefan (Post 1383499)
I've already told you this one year ago :D http://forums.graalonline.com/forums...ad.php?t=71633

I don't think I understood quite what you meant at the time >_<, so I forgot.

But I would still like it if you documented this stuff :p

Was wondering why it is only working with arrays and not strings or numbers? I've just realized how this could be very useful but don't want to wrap data in an array.

And after thinking about it a bit more I'm wondering if you could let it be used anywhere even outside of functions?

Crow 04-02-2008 02:12 PM

Quote:

Originally Posted by Inverness (Post 1383565)
I don't think I understood quite what you meant at the time >_<, so I forgot.

But I would still like it if you documented this stuff :p

Was wondering why it is only working with arrays and not strings or numbers? I've just realized how this could be very useful but don't want to wrap data in an array.

And after thinking about it a bit more I'm wondering if you could let it be used anywhere even outside of functions?

I doubt it only works with arrays, but arrays are a good example to show how efficient this can be. Instead of copying the whole (sometimes big) array, you can point to it and dont waste such huge amounts of memory and you can change it without the need to send the changes back.

zokemon 04-03-2008 05:59 PM

Quote:

Originally Posted by Inverness (Post 1383565)
I don't think I understood quite what you meant at the time >_<, so I forgot.

But I would still like it if you documented this stuff :p

Was wondering why it is only working with arrays and not strings or numbers? I've just realized how this could be very useful but don't want to wrap data in an array.

And after thinking about it a bit more I'm wondering if you could let it be used anywhere even outside of functions?

In almost all cases for GS2, an array is simply a string.

Chompy 04-04-2008 12:14 AM

Quote:

Originally Posted by zokemon (Post 1383953)
In almost all cases for GS2, an array is simply a string.

PHP Code:

function onCreated() {
  
temp.string "rawr,";
  echo(
string.type());


rawr, 3

Inverness 04-04-2008 12:55 AM

Well why don't you jackasses try it for yourselves instead of trying to tell me how I don't know what I'm talking about. Using link() to send an array pointer as a function parameter works fine but you cannot treat that array pointer as a string.

Chompy 04-04-2008 03:48 PM

Quote:

Originally Posted by Inverness (Post 1384026)
Well why don't you jackasses try it for yourselves instead of trying to tell me how I don't know what I'm talking about. Using link() to send an array pointer as a function parameter works fine but you cannot treat that array pointer as a string.

I've tried, but I didn't get it to work :(

Inverness 04-04-2008 10:52 PM

PHP Code:

//WORKS
function onCreated() {
  
temp.= {"lol pancake"};
  
this.addto(temp.v.link(), "o.o");
}
function 
addto(var, val) {
  var[
0] @= val;
}
// DOES NOT WORK
function onCreated() {
  
temp."lol pancake";
  
this.addto(temp.v.link(), "o.o");
}
function 
addto(var, val) {
  var @= 
val;




All times are GMT +2. The time now is 08:18 PM.

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