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 06-24-2004, 04:14 PM
JohnGames JohnGames is offline
Registered User
Join Date: Jun 2004
Posts: 107
JohnGames is on a distinguished road
Tokenize problems for guild script

In the following script I am making a guild maker. The set command works but it is overwritten by the next tokenize. When I say '/set something' it says
'set to something'. But when I say '/add JohnGames' it says 'You have been added to Johns Free home system! Your house number is 'JohnGames'. I want it to keep the tokens seperate.

NPC Code:
if(startswith(/Set,#c)){
tokenize #c;
say2 set to #t(1);
}

if(startswith(/add,#c)){
tokenize #c;
addguildmember House #t(1),#t(2);

with (getplayer(#t(2))){
say2 You have been added to#b
Johns Free home system!#b
Your house number is #t(1);
}
}


Last edited by JohnGames; 06-24-2004 at 04:32 PM..
Reply With Quote
  #2  
Old 06-24-2004, 04:26 PM
Crono Crono is offline
:pluffy:
Join Date: Feb 2002
Location: Sweden
Posts: 20,000
Crono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond repute
Read the rule thing jagen posted. It must be in code tags or whatever and use the graal standard thingys. I'm not sure but I think it's something like

NPC Code:

if (playerenters) {
message Wtf crono doesnt script!;
}

__________________
Reply With Quote
  #3  
Old 06-24-2004, 05:00 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
Try saying /add 1 JohnGames and it will work. Also if you want a suggestion, make sure to the system be more secure, like checking if the house number will be > 0, tokenscount > 2 and so.
__________________
"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
  #4  
Old 06-24-2004, 05:37 PM
JohnGames JohnGames is offline
Registered User
Join Date: Jun 2004
Posts: 107
JohnGames is on a distinguished road
Quote:
Originally Posted by osrs
Try saying /add 1 JohnGames and it will work. Also if you want a suggestion, make sure to the system be more secure, like checking if the house number will be > 0, tokenscount > 2 and so.
THank you very much. They are there but I removed them for posting since they do not cause the problem
Reply With Quote
  #5  
Old 06-24-2004, 06:03 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
if you need to hold information from a tokenize, create a new string/variable from that token, don't rely on the #t's (same goes with the #p's)
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
Reply With Quote
  #6  
Old 06-24-2004, 06:08 PM
JohnGames JohnGames is offline
Registered User
Join Date: Jun 2004
Posts: 107
JohnGames is on a distinguished road
Quote:
Originally Posted by Dach
if you need to hold information from a tokenize, create a new string/variable from that token, don't rely on the #t's (same goes with the #p's)

Thank you for the hint. THank you people who script mostly. I never us the file commands except if. (maybe I should start using them)
Reply With Quote
  #7  
Old 06-24-2004, 06:32 PM
Trevor Trevor is offline
True
Trevor's Avatar
Join Date: Mar 2003
Posts: 2,253
Trevor is on a distinguished road
Quote:
Originally Posted by Dach
if you need to hold information from a tokenize, create a new string/variable from that token, don't rely on the #t's (same goes with the #p's)
Why can you not rely on tokenize to keep the tokens until its next call? I would trust the Graal client more to store strings of tokens than myself.
__________________


name: Trevor Fancher
email: trevor at fancher dot org
home page: fancher.org
Reply With Quote
  #8  
Old 06-24-2004, 06:33 PM
JohnGames JohnGames is offline
Registered User
Join Date: Jun 2004
Posts: 107
JohnGames is on a distinguished road
Quote:
Originally Posted by Trevor
Why can you not rely on tokenize to keep the tokens until its next call? I would trust the Graal client more to store strings of tokens than myself.
My script overwrites them... I lose them instantly
Reply With Quote
  #9  
Old 06-24-2004, 07:32 PM
Trevor Trevor is offline
True
Trevor's Avatar
Join Date: Mar 2003
Posts: 2,253
Trevor is on a distinguished road
Quote:
Originally Posted by JohnGames
My script overwrites them... I lose them instantly
I do not see where it overwrites them. At the very least the tokens should stay until the end of the current control scope. And since you only call tokenize at the top of each control scope, how in the world are you overwriting them?

Also, I'm pretty sure that #t's are read-only. So the only thing that can assign new values to them is a call to tokenize.
__________________


name: Trevor Fancher
email: trevor at fancher dot org
home page: fancher.org
Reply With Quote
  #10  
Old 06-24-2004, 07:50 PM
JohnGames JohnGames is offline
Registered User
Join Date: Jun 2004
Posts: 107
JohnGames is on a distinguished road
Quote:
Originally Posted by Trevor
I do not see where it overwrites them. At the very least the tokens should stay until the end of the current control scope. And since you only call tokenize at the top of each control scope, how in the world are you overwriting them?

Also, I'm pretty sure that #t's are read-only. So the only thing that can assign new values to them is a call to tokenize.

The script call is over when I call it again as something new; so it went away
Reply With Quote
  #11  
Old 06-24-2004, 08:45 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
What I said isn't needed in the little snippet he gave, but I was really just refering to the general case. Osrs already pointed out the answer to his primary dilemma.

You can't lose them instantly without tokenizing something else (tokenize isn't local, so holding something for longer than one block of code isn't secure), same goes for parameters (#p) but more than one command will assign information to those.
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
Reply With Quote
  #12  
Old 06-24-2004, 09:10 PM
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 JohnGames
Thank you for the hint. THank you people who script mostly. I never us the file commands except if. (maybe I should start using them)
The 'file commands'...?
Reply With Quote
  #13  
Old 06-24-2004, 09:50 PM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
If is not a command
Reply With Quote
  #14  
Old 06-24-2004, 10:10 PM
JohnGames JohnGames is offline
Registered User
Join Date: Jun 2004
Posts: 107
JohnGames is on a distinguished road
Quote:
Originally Posted by Python523
If is not a command
I meant those file things
Reply With Quote
  #15  
Old 06-25-2004, 12:27 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 JohnGames
I meant those file things
What file things?
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 11:01 AM.


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