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
  #16  
Old 10-18-2003, 11:58 PM
Idrox0 Idrox0 is offline
Registered User
Join Date: Oct 2003
Posts: 66
Idrox0 is on a distinguished road
Quote:
Origianally posted by: Lance
Um, no I'm not. You can say more words than you call the tokens of -
I know you can say more words than tokens, but i don't think the NPC would show all of them(which is what I want).
__________________
Reply With Quote
  #17  
Old 10-19-2003, 12:45 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

I know you can say more words than tokens, but i don't think the NPC would show all of them(which is what I want).
Well, I was still talking about your original code, not about the fiting code.

Out of curiosity, what do you need to use all of the tokens for? There are a variety of ways to get what you want, but they really depend on your application.
Reply With Quote
  #18  
Old 10-19-2003, 10:34 AM
Idrox0 Idrox0 is offline
Registered User
Join Date: Oct 2003
Posts: 66
Idrox0 is on a distinguished road
Alright... what I'm trying to get is an npc that when you put a certain prefix such as "/moo" that it would show all the words after it on all the players' screens. Something like the Events Team thing on Babylon where when they they say "setevent2" that everything else appears on the top-left of the players' screens. Capiche? Again, does DoomsDay have a website?
__________________
Reply With Quote
  #19  
Old 10-19-2003, 11:03 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
Quote:
Originally posted by DustyPorViva
Well try this I guess, again I haven't tested:
You know if you put -1 for the length it will go to the end?
Reply With Quote
  #20  
Old 10-19-2003, 11:09 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
I knew it, just never used it I guess.
Reply With Quote
  #21  
Old 10-19-2003, 09:16 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
Quote:
Originally posted by Idrox0
Alright... what I'm trying to get is an npc that when you put a certain prefix such as "/moo" that it would show all the words after it on all the players' screens. Something like the Events Team thing on Babylon where when they they say "setevent2" that everything else appears on the top-left of the players' screens. Capiche? Again, does DoomsDay have a website?
<code removed>

Capiche? :grin:
__________________
"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
  #22  
Old 10-19-2003, 09:19 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
No script posting allowed, sorry, but Kai deleted mines.
Reply With Quote
  #23  
Old 10-19-2003, 10:15 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
Quote:
Originally posted by DustyPorViva
No script posting allowed, sorry, but Kai deleted mines.
I don't think that's a whole code.
__________________
"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
  #24  
Old 10-20-2003, 12:47 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
Mines was just as short.
Reply With Quote
  #25  
Old 10-20-2003, 01:26 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
osrs: pointless to use #T if you are using 5 as the startindex, as that forces you to have a space in front of it for the #e to cut it off, and then there's nothing left for the #T to trim.
Reply With Quote
  #26  
Old 10-20-2003, 02:00 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 Lance
osrs: pointless to use #T if you are using 5 as the startindex, as that forces you to have a space in front of it for the #e to cut it off, and then there's nothing left for the #T to trim.
Hm, really. >.>
I don't know why i used #T since i put -1 as length too.
My bad.
__________________
"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
  #27  
Old 10-23-2003, 06:01 AM
ZeLpH_MyStiK ZeLpH_MyStiK is offline
Scripter
ZeLpH_MyStiK's Avatar
Join Date: May 2003
Location: NYC
Posts: 553
ZeLpH_MyStiK is on a distinguished road
Send a message via MSN to ZeLpH_MyStiK Send a message via Yahoo to ZeLpH_MyStiK
ok here's an pre-alpha version lol might not work probably will tho

<removed>


as i said i think this should work so copy it and try it...if not ur welcome to contact me and i'll fix it for you
__________________
Reply With Quote
  #28  
Old 10-23-2003, 06:08 AM
ZeLpH_MyStiK ZeLpH_MyStiK is offline
Scripter
ZeLpH_MyStiK's Avatar
Join Date: May 2003
Location: NYC
Posts: 553
ZeLpH_MyStiK is on a distinguished road
Send a message via MSN to ZeLpH_MyStiK Send a message via Yahoo to ZeLpH_MyStiK
o.O im sorry cant read lol you want it to display everything except the first word well here:

<removed>

this is better than using tokens because it'll let you use commas where as if u use tokenize and u say something like "hello, to myself" it'll only display "hello"
hope this helps
__________________
Reply With Quote
  #29  
Old 10-23-2003, 07:59 AM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
Quote:
Originally posted by osrs


Hm, really. >.>
I don't know why i used #T since i put -1 as length too.
My bad.
#T has no relationship between the -1 at all

it's used so, say I say:
/testTEST
/test TEST
strequals(#T(#e(5,-1,#c)),TEST)
both instances would return true

but well... I guess it does have some sort of relation with the 01, #T is trimming all spaces at the from and end of a string
so #T( test ) = test #T ( 123) = 123, etc, most people just don't need to use it for the end part because they know to use -1, instead of say just guessing the length is going to be 100 then trimming it
Reply With Quote
  #30  
Old 10-23-2003, 09:29 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
Zelph: Stop posting full scripts to solve people's problems. -_-
Reply With Quote
  #31  
Old 10-23-2003, 04:29 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
Quote:
Originally posted by Python523

#T has no relationship between the -1 at all

it's used so, say I say:
/testTEST
/test TEST
strequals(#T(#e(5,-1,#c)),TEST)
both instances would return true

but well... I guess it does have some sort of relation with the 01, #T is trimming all spaces at the from and end of a string
so #T( test ) = test #T ( 123) = 123, etc, most people just don't need to use it for the end part because they know to use -1, instead of say just guessing the length is going to be 100 then trimming it
I know #T has no relationship between the -1.
I jus said that #T was really not needed there. x.x'
Reply With Quote
  #32  
Old 10-24-2003, 01:29 AM
ZeLpH_MyStiK ZeLpH_MyStiK is offline
Scripter
ZeLpH_MyStiK's Avatar
Join Date: May 2003
Location: NYC
Posts: 553
ZeLpH_MyStiK is on a distinguished road
Send a message via MSN to ZeLpH_MyStiK Send a message via Yahoo to ZeLpH_MyStiK
Sorry Lance, as you have probably noticed, im new to posting on the forum, as i had my password changed and the forum password did not changed along with my account password. I never bothered to check the rules, which states no posting scripts that players can just copy and paste. So this is a apologize to all and hope you can all forgive me.
__________________
Reply With Quote
  #33  
Old 10-24-2003, 03:54 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 ZeLpH_MyStiK
Sorry Lance, as you have probably noticed, im new to posting on the forum, as i had my password changed and the forum password did not changed along with my account password. I never bothered to check the rules, which states no posting scripts that players can just copy and paste. So this is a apologize to all and hope you can all forgive me.
S'ok; now that you know, it's all good.
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 01:03 AM.


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