Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-16-2003, 12:10 AM
Idrox0 Idrox0 is offline
Registered User
Join Date: Oct 2003
Posts: 66
Idrox0 is on a distinguished road
Question Tokens...

Does anyone know how to make a code that will show as many tokens as made? An example...

NPC Code:

if (playerchats) {
tokenize #c;
message #t(0) #t(1) ...;
}



How would I make the npc show just as many words as said? I have tried this next code to show the text you say up to a limit of five:

NPC Code:

if (playerchats) {
tokenize #c;
message #t(0) #t(1) #t(2) #t(3) #t(4);
}



But it wont say anything. I once saw the code, but it was on Doomsday, and that's gone. Anyone know it?
__________________
Reply With Quote
  #2  
Old 10-16-2003, 12:17 AM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
use tokenscount to get the number of tokens and work from there
Reply With Quote
  #3  
Old 10-16-2003, 01:26 AM
Nappa Nappa is offline
The Great Nappa
Nappa's Avatar
Join Date: Sep 2003
Location: Florida
Posts: 1,911
Nappa is on a distinguished road
Send a message via AIM to Nappa
Wouldn't it be easier to use #e ?
__________________
Reply With Quote
  #4  
Old 10-16-2003, 01:27 AM
Riot-Starter Riot-Starter is offline
Registered User
Join Date: Aug 2001
Location: Central Florida, USA
Posts: 79
Riot-Starter is on a distinguished road
Send a message via AIM to Riot-Starter
Why use tokenize when you are displaying what the player said?
message #c; would make more sense to me.
Reply With Quote
  #5  
Old 10-16-2003, 01:36 AM
osrs osrs is offline
Graalian since 1998
osrs's Avatar
Join Date: Mar 2002
Location: Brazil
Posts: 2,724
osrs is on a distinguished road
Send a message via ICQ to osrs Send a message via AIM to osrs Send a message via MSN to osrs Send a message via Yahoo to osrs
Quote:
Originally posted by Riot-Starter
Why use tokenize when you are displaying what the player said?
message #c; would make more sense to me.
I think he wants to know how much words are displayed.
__________________
"Ability is what you are capable of doing. Motivation determines what you do. Attitude determines how well you do it."
Facebook: facebook.com/raysilvadotnet /
Reply With Quote
  #6  
Old 10-17-2003, 05:26 AM
Idrox0 Idrox0 is offline
Registered User
Join Date: Oct 2003
Posts: 66
Idrox0 is on a distinguished road
Ok, I would use #c, but i want something a bit more, like, everything except the first word. Anyone get this? I already know what tokenscount is and all. Like, if i said "/moo Hello, my name is bob." the npc would say, "Hello, My name is Bob". Or if i said, "/moo It's a fine day out, isn't it?" it would say, "It's a fine day out, isn't it?" Something that would put as many tokens as words you say. What is the syntax/formula for that?
__________________
Reply With Quote
  #7  
Old 10-17-2003, 05:39 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
NPC Code:

if (playerchats) {
setplayerprop #c,#e(strlen(#I(#c,0)),strlen(#c)-strlen(#I(#c,0)),#c);
}



Didn't test it, but is that what your looking for?
Reply With Quote
  #8  
Old 10-17-2003, 05:43 AM
Lance Lance is offline
dark overlord
Lance's Avatar
Join Date: Sep 2003
Location: Space Jam Mountain
Posts: 5,072
Lance is on a distinguished road
Re: Tokens...

Quote:
Originally posted by Idrox0
Does anyone know how to make a code that will show as many tokens as made? An example...

NPC Code:

if (playerchats) {
tokenize #c;
message #t(0) #t(1) ...;
}



How would I make the npc show just as many words as said? I have tried this next code to show the text you say up to a limit of five:

NPC Code:

if (playerchats) {
tokenize #c;
message #t(0) #t(1) #t(2) #t(3) #t(4);
}



But it wont say anything. I once saw the code, but it was on Doomsday, and that's gone. Anyone know it?
This may be reaching, but...could you be possibly trying this in a weapon NPC instead of a level NPC?

If it's a level NPC, then that code you said should just work fine. If it's a weapon, then it will not, as the NPC does not physically exist in the level for the message command to work, and you will want to use setplayerprop #c,(stuff); to change the player's chat.
Reply With Quote
  #9  
Old 10-17-2003, 09:12 AM
Idrox0 Idrox0 is offline
Registered User
Join Date: Oct 2003
Posts: 66
Idrox0 is on a distinguished road
Well dusty, the code didn't work, but the syntax i saw on DoomsDay was very similar... and no, it's not in a weapon, just an NPC.
__________________
Reply With Quote
  #10  
Old 10-17-2003, 09:42 AM
Lance Lance is offline
dark overlord
Lance's Avatar
Join Date: Sep 2003
Location: Space Jam Mountain
Posts: 5,072
Lance is on a distinguished road
Quote:
Originally posted by Idrox0
Well dusty, the code didn't work, but the syntax i saw on DoomsDay was very similar... and no, it's not in a weapon, just an NPC.
Oh, I see what it's doing. With your (not Dusty's) code, it will only message if you have n-1 words in your chat text, where n is the amount of tokens you were trying to display with that message. So, if you're trying to display #t(0) through #t(4), that's 5 tokens, so you would have to say 4 or more words for it to work.

As for Dusty's code:
Dusty, when exactly is the string containing your chat text a string list?
Reply With Quote
  #11  
Old 10-17-2003, 06:36 PM
osrs osrs is offline
Graalian since 1998
osrs's Avatar
Join Date: Mar 2002
Location: Brazil
Posts: 2,724
osrs is on a distinguished road
Send a message via ICQ to osrs Send a message via AIM to osrs Send a message via MSN to osrs Send a message via Yahoo to osrs
I think #e() is your problem.
__________________
"Ability is what you are capable of doing. Motivation determines what you do. Attitude determines how well you do it."
Facebook: facebook.com/raysilvadotnet /
Reply With Quote
  #12  
Old 10-17-2003, 09:48 PM
Idrox0 Idrox0 is offline
Registered User
Join Date: Oct 2003
Posts: 66
Idrox0 is on a distinguished road
Did Doomsday have a website? If so, I can get the script there. And Lance, you're wrong, it can't be 4 or more... just 4:o.
__________________
Reply With Quote
  #13  
Old 10-17-2003, 10:08 PM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
If you were a pretty good scripter, you'd figure it out yourself :-p

The simplest way would be to use #e, using the first token's length to deduce the second token's start index.
__________________
Reply With Quote
  #14  
Old 10-17-2003, 10:25 PM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
Quote:
Originally posted by Idrox0
Did Doomsday have a website? If so, I can get the script there. And Lance, you're wrong, it can't be 4 or more... just 4:o.
did you even check it? Or did you just assume that because you want it to work a certain way means that it only works that way even if you didn't script it that way?

whats up with that n-1 thing anyhow? I would've figured that if it were to not work in any circumstances it just wouldn't work if the tokenscount was any less than the highest index of tokens being looked at...
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
Reply With Quote
  #15  
Old 10-18-2003, 02:25 AM
Lance Lance is offline
dark overlord
Lance's Avatar
Join Date: Sep 2003
Location: Space Jam Mountain
Posts: 5,072
Lance is on a distinguished road
Quote:
Originally posted by Idrox0
And Lance, you're wrong, it can't be 4 or more... just 4:o.
Um, no I'm not. You can say more words than you call the tokens of - it's just when you say fewer words than tokens called minus one that there's a problem. Test it for yourself.

Quote:
Originally posted by Dach


whats up with that n-1 thing anyhow? I would've figured that if it were to not work in any circumstances it just wouldn't work if the tokenscount was any less than the highest index of tokens being looked at...
No idea. The engine apparently tolerates one variable that doesn't exist, but having any more than that will cause it to misbehave.
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 04:10 PM.


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