Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Tokenize and this. (https://forums.graalonline.com/forums/showthread.php?t=15537)

Jerrytyrrell64 10-27-2001 07:17 AM

Tokenize and this.
 
[B][SIZE=4][FONT=arial][COLOR=crimson]
Please can someone thougholy explaine this dot to me and tokenize too and please give an exaple script for both thanks you minght wven get rewarded a cool script.
[COLOR=orange][FONT=times new roman]
Email Me Please[list]
:confused:

Shard_IceFire 10-27-2001 07:54 AM

Re: Tokenize and this.
 
Quote:

Originally posted by Jerrytyrrell64
[B][SIZE=4][FONT=arial][COLOR=crimson]
Please can someone thougholy explaine this dot to me and tokenize too and please give an exaple script for both thanks you minght wven get rewarded a cool script.
[COLOR=orange][FONT=times new roman]
Email Me Please[list]
:confused:

Yeah, you sound real professional.

Aknts 10-27-2001 08:43 AM

Re: Re: Tokenize and this.
 
Quote:

Originally posted by Shard_IceFire

Yeah, you sound real professional.

Suck ass dip-****.

royce 10-27-2001 10:04 AM

'this.' = a variable...even i know that...i did not type this guide adn i forget who did so i do not take the credit for it...here it is

variables:
there are 2 types of variables
1. the global (for every NPC in the room)
2. this. variables for only one NPC

variables are used for numbers and stuff like this...
example

if(playertouchsme){
a=1+3;
message #v(a);
}

if u touch him he will say 4 =)

so this variables:

if u have an NPC which uses normal variables (without this) it is set for all npcs in the level
example:
1. NPC:
if(playertouchsme){
a=1+3;
message #v(a);
}

2. NPC
if(playertouchsother){
message #v(a);
}

so if u touch the 1. NPC both will say 4

if u use this.variables
example:
1. NPC:
if(playertouchsme){
this.a=1+3;
message #v(a);
}

2. NPC
if(playertouchsother){
message #v(this.a);
}

then if u touch the first NPC it will say 4 but the second will say 0 (it's what every variable is before u set it)

so strings:
if u wanna save text or numbers for every level (for example a bank) u have to use strings
the are set with:
setstring stringname,number or text;

for example 3 NPCs in 2 differnet levels
1. NPC:
if(playertouchsme){
message ouch;
setstring ouch, fred;
}

2. NPC:
if(playertouchsme){
message ouch;
setstring ouch, Karl;
}

3. NPC:
if(playertouchsme){
message You touched #s(ouch);
}

the 1. and 2. NPC are in the 1. Level the 3. NPC is in the 2. level
1. NPCs name: fred
2. NPCsname Karl

so if u touch fred in the first level and then u go into the second level and touches the NPC he will say
You touched fred

the #s() is necessary if u want to handle with strings

If u wanna clear a string use:
setstring stringname,;

TDO2000 10-27-2001 10:45 AM

I wrote this guide some days ago ;)

TDO2000 10-27-2001 10:53 AM

So tokenize ok (just show tokenize not tokenize2 if he knows the first the 2end is no problem either)


say u have a string like this:

blupp=I am a bastard

so if u do

tokenize #s(blupp);

every word is a token u can read from #t()
here it would be like this:
#t(0) = I
#t(1) = am
#t(2) = a
#t(3) = bastard

it's usefull if u wanna do a warper for example:

if(playerchats && startswith(warpto,#c)){
tokenize #c;
setlevel2 #t(1),strtofloat(#t(2)),strtofloat(#t(3));
}

useage: say warpto levelname x-pos ypos

u can read out how many tokens are made with the variable tokenscount for example
if(playerchats){
tokenize #c;
}
for(this.i=0;this.i < tokenscount;this.i++){
setstring sayed,#s(sayed) #t(this.i);
}

silly example but so u could write every token into this string (I used it for an hotel where u can buy a room and I use only one serverstring because of tokens =D)

royce 10-27-2001 11:39 AM

yea..give him all the credit

nyghtGT 10-27-2001 03:03 PM

Quote:

Originally posted by TDO2000
So tokenize ok (just show tokenize not tokenize2 if he knows the first the 2end is no problem either)


say u have a string like this:

blupp=I am a bastard

so if u do

tokenize #s(blupp);

every word is a token u can read from #t()
here it would be like this:
#t(0) = I
#t(1) = am
#t(2) = a
#t(3) = bastard

it's usefull if u wanna do a warper for example:

if(playerchats && startswith(warpto,#c)){
tokenize #c;
setlevel2 #t(1),strtofloat(#t(2)),strtofloat(#t(3));
}

useage: say warpto levelname x-pos ypos

u can read out how many tokens are made with the variable tokenscount for example
if(playerchats){
tokenize #c;
}
for(this.i=0;this.i < tokenscount;this.i++){
setstring sayed,#s(sayed) #t(this.i);
}

silly example but so u could write every token into this string (I used it for an hotel where u can buy a room and I use only one serverstring because of tokens =D)

I allready knew how to use em but that is one very good explanation ...

nyghtGT 10-27-2001 03:04 PM

Re: Re: Re: Tokenize and this.
 
Quote:

Originally posted by Aknts


Suck ass dip-****.

shut up spanky ...

btedji 10-28-2001 04:29 AM

next time look on the forum before asking for help


All times are GMT +2. The time now is 07:59 PM.

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