Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Tokenize problems for guild script (https://forums.graalonline.com/forums/showthread.php?t=53364)

JohnGames 06-24-2004 04:14 PM

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);
}
}


Crono 06-24-2004 04:26 PM

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!;
}


osrs 06-24-2004 05:00 PM

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. ^^

JohnGames 06-24-2004 05:37 PM

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

Dach 06-24-2004 06:03 PM

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)

JohnGames 06-24-2004 06:08 PM

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)

Trevor 06-24-2004 06:32 PM

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.

JohnGames 06-24-2004 06:33 PM

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 :)

Trevor 06-24-2004 07:32 PM

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.

JohnGames 06-24-2004 07:50 PM

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

Dach 06-24-2004 08:45 PM

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.

Lance 06-24-2004 09:10 PM

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'...?

Python523 06-24-2004 09:50 PM

If is not a command

JohnGames 06-24-2004 10:10 PM

Quote:

Originally Posted by Python523
If is not a command

I meant those file things

Lance 06-25-2004 12:27 AM

Quote:

Originally Posted by JohnGames
I meant those file things

What file things?

JohnGames 06-25-2004 12:36 AM

Quote:

Originally Posted by Lance
What file things?

top part og script examples

WanDaMan 06-25-2004 04:22 AM

You guys know what he means, why must you act like asses?

Crono 06-25-2004 04:33 AM

Quote:

Originally Posted by WanDaMan
You guys know what he means, why must you act like asses?

Why must scripters either be hyperactive or so grumpy :[?

Lance 06-25-2004 11:41 AM

Quote:

Originally Posted by WanDaMan
You guys know what he means, why must you act like asses?

Actually, I didn't, and still don't. Sorry? I'm happy to help people and answer questions, but first they need to be clear about whatever the heck they're talking about.

JohnGames: are you talking about commands.rtf, npcprogramming.doc, or what?

WanDaMan 06-25-2004 03:23 PM

He's talking if () {}

Malinko 06-25-2004 04:34 PM

Quote:

Originally Posted by Gerami
Why must scripters either be hyperactive or so grumpy :[?

Because erm. Muffins. O_o.

JohnGames 06-26-2004 02:44 AM

Quote:

Originally Posted by Lance
Actually, I didn't, and still don't. Sorry? I'm happy to help people and answer questions, but first they need to be clear about whatever the heck they're talking about.

JohnGames: are you talking about commands.rtf, npcprogramming.doc, or what?

My porblem was already solved. I was reffering to the 'when' file command that is done in npc scripting. I said I never use those commands EXCEPT 'if'

Xecutor 06-26-2004 03:38 AM

Man, you really need to learn some type of terminology.

JohnGames 06-26-2004 03:39 AM

Quote:

Originally Posted by Xecutor
Man, you really need to learn some type of terminology.

I dont script a lot


All times are GMT +2. The time now is 01:25 AM.

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