Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-21-2007, 05:46 PM
sam_is_me sam_is_me is offline
Registered User
Join Date: Sep 2004
Posts: 195
sam_is_me is on a distinguished road
Random Scripts

So, since I have to do this offline, its in gs1. I need to figure out how to put a random script, instead of numbers, into names. heres what I have so far:
NPC Code:

if(playerchats && strequals(#c,:choose)){
setcharprop #c,var(int(random(1,5)));
sleep1;
message ;
}



If that's wrong, sorry, I'm trying to remember what I have, and GraalEditor isnt working at the moment, but yeah, i have a working random number script tiggered by the player saying :choose..

But how do I assign numbers to NAMES, do I use flags, or what...
:]
thanks
__________________
Aim: xxspazmxx929


Reply With Quote
  #2  
Old 05-21-2007, 07:49 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
PHP Code:
if (playerchats && strequals(#c,:choose)) {
  
tokenize "Hello World!" "Boo ya!" "Whoop whoop." ":D";
  
setplayerprop #c,#t(int(random(0,tokenscount)));

Reply With Quote
  #3  
Old 05-21-2007, 08:08 PM
Deadly_Killer Deadly_Killer is offline
Registered User
Join Date: Feb 2002
Posts: 227
Deadly_Killer is on a distinguished road
You should not overload your event-statements

PHP Code:
if (playerchats)
{
  if (
strequals(#c,:choose))
  
{
    
// etc
  
}

__________________
- Zidane / Zidaya
Reply With Quote
  #4  
Old 05-21-2007, 08:12 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
You say it with such enthusiasm as though he's going to break something. It's preference really, and as they're highly related, I don't see the problem.
Reply With Quote
  #5  
Old 05-21-2007, 08:21 PM
Deadly_Killer Deadly_Killer is offline
Registered User
Join Date: Feb 2002
Posts: 227
Deadly_Killer is on a distinguished road
http://forums.graal2001.com/forums/s...ad.php?t=46557
__________________
- Zidane / Zidaya
Reply With Quote
  #6  
Old 05-21-2007, 08:42 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Funny you should post that:
"Similarly to rule three, do not combine unrelated conditional statements. Instead of writing shambling messes like this:"
Reply With Quote
  #7  
Old 05-22-2007, 04:36 AM
sam_is_me sam_is_me is offline
Registered User
Join Date: Sep 2004
Posts: 195
sam_is_me is on a distinguished road
What does the 0,Tokenscount
do?
I dont know what they stand for..
Everything else I get.
__________________
Aim: xxspazmxx929


Reply With Quote
  #8  
Old 05-22-2007, 06:03 AM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
Quote:
Originally Posted by sam_is_me View Post
What does the 0,Tokenscount
do?
I dont know what they stand for..
Everything else I get.
0, tokenscount.

Heres a tip, you must ALWAYS pay attention to comma's (unless they are wrapped in quotes)
Reply With Quote
  #9  
Old 05-22-2007, 04:55 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
That would be the random statement, getting a random chunk of text. 0 would be the minimum, and tokenscount would be the max(tokenscount is the number of tokens when using tokenize).
Reply With Quote
  #10  
Old 05-22-2007, 06:08 AM
Deadly_Killer Deadly_Killer is offline
Registered User
Join Date: Feb 2002
Posts: 227
Deadly_Killer is on a distinguished road
Aren't you supposed to do tokenscount + 1? ( random shouldn't pick the highest number)

Or does tokenscount not start with 0?
__________________
- Zidane / Zidaya
Reply With Quote
  #11  
Old 05-22-2007, 05:35 PM
sam_is_me sam_is_me is offline
Registered User
Join Date: Sep 2004
Posts: 195
sam_is_me is on a distinguished road
Oh, I get it.
Couldn't you use
tokenscount,tokenscount
though?
__________________
Aim: xxspazmxx929


Reply With Quote
  #12  
Old 05-22-2007, 06:00 PM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Quote:
Originally Posted by sam_is_me View Post
Oh, I get it.
Couldn't you use
tokenscount,tokenscount
though?
Thats like saying random(1, 1)
As stated, the 0 is the minimum meaning it is the lowest possible number to be rolled.
tokenscount is the maximum meaning it is the highest number (actually, random never "reaches" the highest number, it just comes close).
__________________
Do it with a DON!
Reply With Quote
  #13  
Old 05-22-2007, 06:07 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Quote:
Originally Posted by zokemon View Post
(actually, random never "reaches" the highest number, it just comes close).
I know, sucks :/
Reply With Quote
  #14  
Old 05-22-2007, 06:10 PM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Quote:
Originally Posted by DustyPorViva View Post
I know, sucks :/
I find that to be a good thing when you are dealing with intergers. There used to be a glitch where it could possibly reach the maximum value which screwed up alot of random intergers.
__________________
Do it with a DON!
Reply With Quote
  #15  
Old 05-22-2007, 05:57 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
tokenscount doesn't start with 0, because it's giving you the actual number of tokens, so if you have four words, it will return 4.
And tokenscount,tokenscount wouldn't work because it'd always pick the last option for text. You used the same method in your script as well. I want to pick between the first text, and the last, randomly. 0-tokenscount means it will randomly pick between the first token and the last.
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 09:52 AM.


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