Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Old Scripting Engine (GS1) (https://forums.graalonline.com/forums/forumdisplay.php?f=154)
-   -   Randomizing the say2 command? (https://forums.graalonline.com/forums/showthread.php?t=75692)

LoneAngelIbesu 07-19-2007 09:44 PM

Randomizing the say2 command?
 
How would I go about randomizing the phrases outputted by the say2 command?

xXziroXx 07-19-2007 09:51 PM

A quick and simple example:

PHP Code:

//#CLIENTSIDE
function onCreated()
{
  
this.texts = {
    
"This is a text!",
    
"Guess what this is? :D"
  
};
  
say2(this.texts[int(random(0this.texts.size() + 1))]);


Hopefully you'll be able to take it from there on your own. :)

Skyld 07-19-2007 09:52 PM

PHP Code:

say2(randomstring(this.texts)); 

... would be faster for the new engine, but since we're talking the old engine here:

PHP Code:

if (created)
{
  
say2 #R(first string,second string,third string);



LoneAngelIbesu 07-19-2007 10:37 PM

They really should've put things like that in the commands file. Thanks a lot, Skyld. Yeah, the old-engine is still used on Valikorlia.

xXziroXx 07-20-2007 04:24 AM

Quote:

Originally Posted by Skyld (Post 1332560)
PHP Code:

say2(randomstring(this.texts)); 

... would be faster for the new engine, but since we're talking the old engine here:

PHP Code:

if (created)
{
  
say2 #R(first string,second string,third string);



Oh right, the randomstring() command - kinda forgott about that one, I've yet to use it in a script.

And I didn't know you wanted it in GS1, buuuut since it's posted in "Old Scripting Engine" I should have payed slightly more attention ^^

You could also do:

PHP Code:

if (created) {
  
setstring this.stringlist,first string,second string,third string;
  
say2 #R(#s(this.stringlist));


Whatever appeals you the most. :)

cbk1994 07-20-2007 05:00 PM

Quote:

Originally Posted by xXziroXx (Post 1332718)
You could also do:

PHP Code:

if (created) {
  
setstring this.stringlist,first string,second string,third string;
  
say2 #R(#s(this.stringlist));


Whatever appeals you the most. :)

Can you really?

I tried something like that, and it said that it didn't take a single string, or such.

GS1 makes no sense :(

It's a weird mix of a conditional language, and a function language :/

Inverness 07-20-2007 06:07 PM

GS1 should be removed from the face of Graal in its entirety. Can't believe Val is still GS1 after so long, its a travesty and a supreme irritation.

xXziroXx 07-21-2007 02:12 AM

Quote:

Originally Posted by cbkbud (Post 1332878)
Can you really?

Yes. I used it several times on Maloria. :)

Horrified 09-01-2007 12:10 AM

Quote:

Originally Posted by Inverness (Post 1332898)
GS1 should be removed from the face of Graal in its entirety. Can't believe Val is still GS1 after so long, its a travesty and a supreme irritation.

these words deserve an agreed.

Crow 09-01-2007 02:14 PM

Quote:

Originally Posted by Horrified (Post 1344997)
these words deserve an agreed.

Old thread is old.


All times are GMT +2. The time now is 04:53 AM.

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