Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   #r (https://forums.graalonline.com/forums/showthread.php?t=43704)

osrs 03-24-2003 07:40 PM

#r
 
Quote:

Originally posted by Kaimetsu
'#R(string)' is equivalent to '#I(string,int(random(0,sarraylen(string)))'
I made this example,wors fine,as Kai said:
NPC Code:

if(created || timeout){
setstring this.names,osrs kaimetsu stefan jagen;
message #I(this.names,int(random(0,sarraylen(this.names))) );
}
timeout=0.05;




why this one don't work?

NPC Code:

if(created || timeout){
setstring this.names,osrs kaimetsu stefan jagen;
message #R(#s(this.names));
}
timeout=0.05;



I made anything wrong? if yes,i'm sorry but i still dont know how to work correctly with #R.

adam 03-24-2003 07:45 PM

Re: #r
 
Quote:

Originally posted by osrs


I made this example,wors fine,as Kai said:
NPC Code:

if(created || timeout){
setstring this.names,osrs kaimetsu stefan jagen;
message #I(this.names,int(random(0,sarraylen(this.names))) );
}
timeout=0.05;




why this one don't work?

NPC Code:

if(created || timeout){
setstring this.names,osrs kaimetsu stefan jagen;
message #R(#s(this.names));
}
timeout=0.05;



I made anything wrong? if yes,i'm sorry but i still dont know how to work correctly with #R.


This is pure guesswork but I would try.

setstring this.names,"osrs","kaimetsu","stefan","jagen";

Python523 03-24-2003 07:45 PM

Re: #r
 
serverside only right now, and try seperating the names by commas? I'm not sure if #R seperates by spaces as well

osrs 03-24-2003 07:57 PM

hmm..now i'm more confuse about #R...:(

Dach 03-24-2003 09:11 PM

try #R(this.names)
I think your parseing the string twice, if #R works the way I think it does

ShadowDarkstar 03-24-2003 11:43 PM

#R only works serverside and online, not offline
and if it's not working online, try separating the names with commas

tlf288 03-25-2003 01:55 AM

Quote:

Originally posted by ShadowDarkstar
#R only works serverside and online
There is a serverside offline?

HoudiniMan 03-25-2003 02:20 AM

Quote:

Originally posted by tlf288


There is a serverside offline?

Meaning not on a server beneath a //#CLIENTSIDE comment tag... Only on the serverside, which would imply it's online... but people are sometimes not smart and think if they don't put //#CLIENTSIDE then it's serverside, even in the editor

Ethic_Sern 03-30-2003 07:00 PM

Re: #r
 
Quote:

Originally posted by osrs


I made this example,wors fine,as Kai said:
NPC Code:

if(created || timeout){
setstring this.names,osrs kaimetsu stefan jagen;
message #I(this.names,int(random(0,sarraylen(this.names))) );
}
timeout=0.05;


Does it only work with random tokens for the string? if not what else could it be used for?

Pokilty 04-17-2003 04:16 AM

Re: Re: #r
 
Quote:

Originally posted by Ethic_Sern

Does it only work with random tokens for the string? if not what else could it be used for?

It seems to me, based on Kai's definition, that all #R does is select a random string from an array of strings. Probably helpful for a card game where you want to draw a random card. I've never seen or used the function myself though... but the definition indicates that it would only work with random tokens otherwise it wouldn't be #R, you could use #s or #t for whatever script you need.


All times are GMT +2. The time now is 09:14 AM.

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