Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Old Scripting Engine (GS1)
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-19-2007, 09:44 PM
LoneAngelIbesu LoneAngelIbesu is offline
master of infinite loops
LoneAngelIbesu's Avatar
Join Date: May 2007
Location: Toldeo, Ohio
Posts: 1,049
LoneAngelIbesu has a spectacular aura aboutLoneAngelIbesu has a spectacular aura about
Send a message via AIM to LoneAngelIbesu
Randomizing the say2 command?

How would I go about randomizing the phrases outputted by the say2 command?
Reply With Quote
  #2  
Old 07-19-2007, 09:51 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
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.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #3  
Old 07-19-2007, 09:52 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
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);

__________________
Skyld
Reply With Quote
  #4  
Old 07-19-2007, 10:37 PM
LoneAngelIbesu LoneAngelIbesu is offline
master of infinite loops
LoneAngelIbesu's Avatar
Join Date: May 2007
Location: Toldeo, Ohio
Posts: 1,049
LoneAngelIbesu has a spectacular aura aboutLoneAngelIbesu has a spectacular aura about
Send a message via AIM to LoneAngelIbesu
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.
Reply With Quote
  #5  
Old 07-20-2007, 04:24 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by Skyld View Post
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.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #6  
Old 07-20-2007, 05:00 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 xXziroXx View Post
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 :/
__________________
Reply With Quote
  #7  
Old 07-20-2007, 06:07 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
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.
__________________
Reply With Quote
  #8  
Old 07-21-2007, 02:12 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by cbkbud View Post
Can you really?
Yes. I used it several times on Maloria.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #9  
Old 09-01-2007, 12:10 AM
Horrified Horrified is offline
Rediculously inactive
Join Date: Jul 2007
Posts: 961
Horrified is on a distinguished road
Send a message via ICQ to Horrified Send a message via AIM to Horrified Send a message via MSN to Horrified Send a message via Yahoo to Horrified
Quote:
Originally Posted by Inverness View Post
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.
Reply With Quote
  #10  
Old 09-01-2007, 02:14 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Horrified View Post
these words deserve an agreed.
Old thread is old.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 12:55 PM.


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