Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   probs with #t (https://forums.graalonline.com/forums/showthread.php?t=12814)

Bhala 09-24-2001 10:46 AM

probs with #t
 
why dosnt this work?

PHP Code:

if(startswithchangegani,#c)){
  
tokenize #c;
replacegani #t(1),#t(3);


I know it has somehing to do with #t but what?

KJS 09-24-2001 06:48 PM

Re: probs with #t
 
Quote:

Originally posted by Bhala
why dosnt this work?

PHP Code:

if(startswithchangegani,#c)){
  
tokenize #c;
replacegani #t(1),#t(3);


I know it has somehing to do with #t but what?

PHP Code:

if(startswith(changegani,#c)&&playerchats){
  
tokenize #c;
  
replacegani #t(1),#t(2);


try that or if that doesn't work try putting #s() befor the #t's

but I just changed 3 to 2 so it is the 3rd word

Shard_IceFire 09-24-2001 08:52 PM

Um...isn't it replaceANI?
NPC Code:

if(startswith(changegani,#c)&&playerchats){
tokenize #c;
replaceani #t(1),#t(2);
}


Sep3kP2P 09-24-2001 10:56 PM

...
 
wouldn't it be...
PHP Code:

if(playerchats&&startswith(changegani ,#c)){ 

dont you need the space after changegani?

Faheria_Admin5 09-25-2001 02:07 AM

I see what your saying Kai.

startswith(str,partstr) right?

WAs a problem for me too the 1st time a tried it. jkust flip floped it and it worked.

ownerofbabylon 09-25-2001 03:58 AM

whats wrong with this?

if(playerenters){
toweapons Warper;
}
if (playerchats&&startswith(warpto,#c)) {
tokenize #c;
if(tokenscount==3){
setlevel2 #t(1),playerx=(2),playery=(3);
}
}

Merlin 09-25-2001 04:11 AM

kai taught me tokenize yesterday:cool:

LilNiglet 09-25-2001 05:00 AM

BLA BLA BLA USE TOKENIZE! lazy bastards

joseyisleet 09-25-2001 06:33 AM

since were talking about tokenizing in here i get this error from a warper code.

'Error: Expected format var, var[i], obj[i].attr, function(a), function(a,b)'

the code is
// NPC made by Josey Hunt
if (playerenters&&staff&&!hasweapon(*Warper)){toweapo ns *Warper;}
if (playerenters&&staff&&hasweapon(*Warper)){message ;}
if (playerenters&&!staff){message ;}
if (playerchats&&!staff&&isweapon){set jailed;}
if (playerchats&&startswith(warpto,#c)&&staff&&isweap on){
tokenize #c;}
if (tokenscount==3){setlevel2 #t(1),#t(2),#t(3);}

the #t(3); part gets the error. anyone know why?

Merlin 09-25-2001 06:44 AM

Quote:

Originally posted by joseyisleet
since were talking about tokenizing in here i get this error from a warper code.

'Error: Expected format var, var[i], obj[i].attr, function(a), function(a,b)'

the code is
// NPC made by Josey Hunt
if (playerenters&&staff&&!hasweapon(*Warper)){toweapo ns *Warper;}
if (playerenters&&staff&&hasweapon(*Warper)){message ;}
if (playerenters&&!staff){message ;}
if (playerchats&&!staff&&isweapon){set jailed;}
if (playerchats&&startswith(warpto,#c)&&staff&&isweap on){
tokenize #c;}
if (tokenscount==3){setlevel2 #t(1),#t(2),#t(3);}

the #t(3); part gets the error. anyone know why?

ugh
first let me try to break it down


if (playerenters) {
if (staff) {
if (hasweapon(*Warper)) {
message ;
}
if (playerenters) {
if (!staff) {
message ';
}
}
if (playerchats) {
if (!staff) {
if (isweapon) {
setlevel2 jail.graal,30,30;
}
}
}
if (playerchats) {
tokenize #c;
if (startswith(warpto,#c)) {
if (isweapon) {
if (staff) {
if (tokenscount==3) {
setstring local.level,#t(3);
timeout = .5;
}
}
}
}
}
if (timeout) {
setlevel2 #s(local.level),#t(1),#t(2);
}


i fixed a few little errors and made it more readable, should work now.
say "warpto x y levelname.graal"

joseyisleet 09-25-2001 07:01 AM

i tried that and i still get the same error. =/

Merlin 09-25-2001 07:06 AM

here is my code,
which i made yesterday

// NPC made by Merlin
//with teaching from kai ;p
//level warper
if (playerenters) {
toweapons Warper;
setgif shadoworb.gif;
}
if (weaponfired) {
say2 Say,#b
warpto x y levelname.graal#b
to warp.#b
-Merlin;
}
if (playerchats) {
tokenize #c;
if (tokenscount==4) {
if (onduty) {
this.x=strtofloat(#t(1));
this.y=strtofloat(#t(2));
setstring local.level,#t(3);
timeout = .5;
}
else{
setplayerprop #c,Go on duty before warping!;
}
}
}
if (timeout) {
setlevel2 #s(local.level),this.x,this.y;
}

joseyisleet 09-25-2001 07:51 AM

i already got it thanks though :D

Bhala 09-25-2001 08:28 AM

no I the start with thing right

PHP Code:

if(startswith(changegani#c)){
  
tokenize #c;
message #t(1);
replacegani #t(1),#t(3);


out puts walk if player says changegani walk to run but it still dosnt work

Merlin 09-25-2001 08:36 AM

try this
if (playerchats) {
if (startswith(changegani,#c)) {

if (tokenscount==3) {
this.oldgani = #t(1);
this.newgani = #t(3);
timeout = .5;
}
if (timeout) {
replaceani this.oldgani,this.newgani;
}

that will work if the command is replaceani but if it is replace gani just add a g before a


All times are GMT +2. The time now is 11:47 AM.

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