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 09-26-2001, 02:40 AM
LiquidIce00 LiquidIce00 is offline
RadioActive Monkeeh
LiquidIce00's Avatar
Join Date: Apr 2001
Location: dirty south
Posts: 2,112
LiquidIce00 is on a distinguished road
Send a message via ICQ to LiquidIce00 Send a message via AIM to LiquidIce00 Send a message via Yahoo to LiquidIce00
#e uses..

Im bored.. so I am going to teach some ppl how to do some neat things using #e..
I learned #e+indexof when I was doing vb (indexof is InStr .. and they also have InStrRev)
Also another thing which can be used with it, is indexof()
#e is used for doing string parsing .. like tokenize and so on..
it allows you to get part of a str .. for example:
setstring hellostring,hello how are you?;
setplayerprop #c,#e(0,3,#s(hellostring));
That would return "hello"
now you might say.. thats useless .. well its not!
for example ..
the bomy script when you say
command one -> command two
you can get the first part and second part easily with #e!
how?
using indexof and strlen it can be easily done

if (playerchats) {
this.indexof=indexof(->,#c);
if (this.indexof>=1) {
setstring command1,#T(#e(0,strlen(#c)-this.indexof,#c));
setstring command2,#T(#e(this.indexof+2,strlen(#c)-this.indexof,#c));
}
}

now to explain ..
I first got the indexof to a variable because i want to make the #e's shorter and also check to see if the player said
something->something
*indexof will return the location of the partstr specified in that string*
then I check to see if this.indexof is >= 1 .. why? because if the partstr does not appear in the string (if they said something that doesnt contain ->) it will return -1.. and I did >=1 because we want to ignore indexof if it is 0 (because that means they said ->something .. and not something->something)

after that we find the first part (before ->) using #e and strlen and the indexof..
command1 of course begins in the beggining so our startindex for #e in command1 will be 0.
the length of the string will be the length of what the player said minus indexof.
for example if the player said "kaka->kaka"
indexof -> will be 4 and strlen of #c will be 10
I did #T() which is trim .. it removes any spaced from the end/beggining of a string. it is useful there because the player could have said "whatever -> whatever"
and we wouldnt want our string to be "whatever " we want it without the space.

the second command is a bit more confusing .. since the startindex is not the beggining of a string, but after the ->
so the only change will be the startindex which will be this.indexof+2
why +2 ? well because the strlen of -> is 2. and if we just did this.indexof then it would return "->whatever" as the 2nd part.. and we dont want that!
so add +2 to eliminate the ->
there you go=)

now just use your imagination ..
here is a little code of something cool that can be done with #e (on UN the chat scroller is using #e.. but a little more complicated.. this is a simple scroller)
[code]
if (playerchats) {
while (strlen(#c)>0) {
sleep .2;
setplayerprop #c,#e(0,strlen(#c)-1,#c);
}
}
[code]
__________________
LiquidIce *Owner* (UnholyNation)
-UN Website
http://www.unholynation.com
-UN Forum
http://forums.unholynation.com
-
-the thinker
-

-
onwall2 for nonp2p (i suck at onwall)

Last edited by LiquidIce00; 09-26-2001 at 03:13 AM..
Reply With Quote
  #2  
Old 09-26-2001, 03:09 AM
LiquidIce00 LiquidIce00 is offline
RadioActive Monkeeh
LiquidIce00's Avatar
Join Date: Apr 2001
Location: dirty south
Posts: 2,112
LiquidIce00 is on a distinguished road
Send a message via ICQ to LiquidIce00 Send a message via AIM to LiquidIce00 Send a message via Yahoo to LiquidIce00
Quote:
Originally posted by Kaimetsu
Wouldn't it be "mid" in VB?
mid+instr+instrrev+len
mid is #e instr is indexof and instrrev is indexof (from the back)
__________________
LiquidIce *Owner* (UnholyNation)
-UN Website
http://www.unholynation.com
-UN Forum
http://forums.unholynation.com
-
-the thinker
-

-
onwall2 for nonp2p (i suck at onwall)
Reply With Quote
  #3  
Old 09-26-2001, 03:48 AM
Falcor Falcor is offline
Darth Cucumber
Falcor's Avatar
Join Date: Mar 2001
Location: At School
Posts: 2,874
Falcor is on a distinguished road
Send a message via ICQ to Falcor Send a message via AIM to Falcor Send a message via MSN to Falcor Send a message via Yahoo to Falcor
setplayerprop #c,#e(0,3,#s(hellostring));

Hel ?

i believe hello is a 5 letter word so it would be

setplayerprop #c,#e(0,5,#s(hellostring));

Just fixing a mistake. could haev ezly pressed the wrong numba.
__________________

subliminal message: 1+1=3
Reply With Quote
  #4  
Old 09-26-2001, 05:49 AM
LiquidIce00 LiquidIce00 is offline
RadioActive Monkeeh
LiquidIce00's Avatar
Join Date: Apr 2001
Location: dirty south
Posts: 2,112
LiquidIce00 is on a distinguished road
Send a message via ICQ to LiquidIce00 Send a message via AIM to LiquidIce00 Send a message via Yahoo to LiquidIce00
Quote:
Originally posted by Falcor
setplayerprop #c,#e(0,3,#s(hellostring));

Hel ?

i believe hello is a 5 letter word so it would be

setplayerprop #c,#e(0,5,#s(hellostring));

Just fixing a mistake. could haev ezly pressed the wrong numba.
no sir startindex starts at 0 not 1
__________________
LiquidIce *Owner* (UnholyNation)
-UN Website
http://www.unholynation.com
-UN Forum
http://forums.unholynation.com
-
-the thinker
-

-
onwall2 for nonp2p (i suck at onwall)
Reply With Quote
  #5  
Old 09-26-2001, 09:15 AM
LiquidIce00 LiquidIce00 is offline
RadioActive Monkeeh
LiquidIce00's Avatar
Join Date: Apr 2001
Location: dirty south
Posts: 2,112
LiquidIce00 is on a distinguished road
Send a message via ICQ to LiquidIce00 Send a message via AIM to LiquidIce00 Send a message via Yahoo to LiquidIce00
Quote:
Originally posted by Kaimetsu


He didn't say otherwise. He was disputing the length parameter.
the length is 5 but he related the length to the startindex .. it is related but not the same ..
__________________
LiquidIce *Owner* (UnholyNation)
-UN Website
http://www.unholynation.com
-UN Forum
http://forums.unholynation.com
-
-the thinker
-

-
onwall2 for nonp2p (i suck at onwall)
Reply With Quote
  #6  
Old 09-26-2001, 09:21 AM
Falcor Falcor is offline
Darth Cucumber
Falcor's Avatar
Join Date: Mar 2001
Location: At School
Posts: 2,874
Falcor is on a distinguished road
Send a message via ICQ to Falcor Send a message via AIM to Falcor Send a message via MSN to Falcor Send a message via Yahoo to Falcor
I see no difference in star index . only the lenght. Or has the number system changed without me knowing?

setplayerprop #c,#e(0,3,#s(hellostring));
And
setplayerprop #c,#e(0,5,#s(hellostring));

There is onne difference.

Length

not start index. not String.

thankyou
__________________

subliminal message: 1+1=3
Reply With Quote
  #7  
Old 09-27-2001, 03:12 AM
LiquidIce00 LiquidIce00 is offline
RadioActive Monkeeh
LiquidIce00's Avatar
Join Date: Apr 2001
Location: dirty south
Posts: 2,112
LiquidIce00 is on a distinguished road
Send a message via ICQ to LiquidIce00 Send a message via AIM to LiquidIce00 Send a message via Yahoo to LiquidIce00
Quote:
Originally posted by Falcor
I see no difference in star index . only the lenght. Or has the number system changed without me knowing?

setplayerprop #c,#e(0,3,#s(hellostring));
And
setplayerprop #c,#e(0,5,#s(hellostring));

There is onne difference.

Length

not start index. not String.

thankyou
no guy...
your startindex begins at 0 .. and your length is the length-1 ..
for example "kaka" is 4 in length . but the length in #e would be 3 because it counts from 0 not 1..
and before you said "i believe hello is a 5 letter word so it would be"
length wouldnt be 5 just because its a 5 letter word. get it
__________________
LiquidIce *Owner* (UnholyNation)
-UN Website
http://www.unholynation.com
-UN Forum
http://forums.unholynation.com
-
-the thinker
-

-
onwall2 for nonp2p (i suck at onwall)
Reply With Quote
  #8  
Old 09-27-2001, 05:36 AM
ArmadeusWarlock ArmadeusWarlock is offline
Registered User
Join Date: Jun 2001
Posts: 373
ArmadeusWarlock is on a distinguished road
hmmmmm

well, im not exactly sure how to use it, but i have used it before for testing crap. anyways, i know what he did wrong, -1 uses the whole message and crap, but you said it starts at 1, so h is 1, e 2,l 3...? if not, and it starts from 0, it would still say hell. dont ask me, im already confused :o
Reply With Quote
  #9  
Old 09-27-2001, 06:10 AM
nyghtGT nyghtGT is offline
Banned
nyghtGT's Avatar
Join Date: Jun 2001
Posts: 3,993
nyghtGT is on a distinguished road
Send a message via AIM to nyghtGT
it starts at 0 like with tokens .... like
i say "Welcome to Graal"
the tokens set would be:
#t(0)=Welcome
#t(1)=to
#t(2)=Graal
then i use:
NPC Code:

if (playerchats) {
tokenize #c;
message #t(0);
sleep 1.25;
message #t(1);
sleep 1.25;
message #t(2);
sleep 1.25;
message ;
}


the npc would say pausing 1 1/4 seconds after each:
Welcome <pause> to <pause> Graal <pause>

Basically the index is the number of items, but the items count starts at one .... so #t(0) has a value.

And i aint a genious but i suppose its the same as setting the index of all things ....

(please correct me if wrong)
Reply With Quote
  #10  
Old 09-27-2001, 06:15 AM
nyghtGT nyghtGT is offline
Banned
nyghtGT's Avatar
Join Date: Jun 2001
Posts: 3,993
nyghtGT is on a distinguished road
Send a message via AIM to nyghtGT
thanx

also, thanx for explaining this liquid i wanted to do something that you could use different parts of the players chatfield ...
all it was was a warper for staff without RC ... and i wanted it where you could just say:

warpto 30,30 levelname.graal without having to set strings and all that ....
Reply With Quote
  #11  
Old 09-27-2001, 06:48 AM
ArmadeusWarlock ArmadeusWarlock is offline
Registered User
Join Date: Jun 2001
Posts: 373
ArmadeusWarlock is on a distinguished road
heh

I have this same idea, and something is always screwed up after i make it. Its always perfect, but its screwed up. it works for the level and x, but not the y. i mean it doesnt work, but it always says there is an error somewhere after the y area.
Reply With Quote
  #12  
Old 09-27-2001, 07:29 AM
Falcor Falcor is offline
Darth Cucumber
Falcor's Avatar
Join Date: Mar 2001
Location: At School
Posts: 2,874
Falcor is on a distinguished road
Send a message via ICQ to Falcor Send a message via AIM to Falcor Send a message via MSN to Falcor Send a message via Yahoo to Falcor
p2p wepons cant warp players.
__________________

subliminal message: 1+1=3
Reply With Quote
  #13  
Old 09-27-2001, 07:42 AM
ArmadeusWarlock ArmadeusWarlock is offline
Registered User
Join Date: Jun 2001
Posts: 373
ArmadeusWarlock is on a distinguished road
hmmmmm

Then how does admin warpto work on NewMain?
Reply With Quote
  #14  
Old 09-27-2001, 07:50 AM
nyghtGT nyghtGT is offline
Banned
nyghtGT's Avatar
Join Date: Jun 2001
Posts: 3,993
nyghtGT is on a distinguished road
Send a message via AIM to nyghtGT
RC

for people with RC (for that server only) they can say:
"warpto x y levelname.graal" and it will warp them ... At least it does on my Delteria RC.
Reply With Quote
  #15  
Old 09-27-2001, 07:52 AM
ArmadeusWarlock ArmadeusWarlock is offline
Registered User
Join Date: Jun 2001
Posts: 373
ArmadeusWarlock is on a distinguished road
OH. I thought he meant warping through the RC itself, not through graal, you now, like changing x and y crap thru graal. Ok, i get it now
Reply With Quote
  #16  
Old 09-27-2001, 07:58 AM
nyghtGT nyghtGT is offline
Banned
nyghtGT's Avatar
Join Date: Jun 2001
Posts: 3,993
nyghtGT is on a distinguished road
Send a message via AIM to nyghtGT
well

welll i am not sure that it works for people with RC on P2P servers being as Delteria is not a pay server ....
Reply With Quote
  #17  
Old 09-28-2001, 12:23 AM
LiquidIce00 LiquidIce00 is offline
RadioActive Monkeeh
LiquidIce00's Avatar
Join Date: Apr 2001
Location: dirty south
Posts: 2,112
LiquidIce00 is on a distinguished road
Send a message via ICQ to LiquidIce00 Send a message via AIM to LiquidIce00 Send a message via Yahoo to LiquidIce00
Quote:
Originally posted by Falcor
p2p wepons cant warp players.
yes u can just do triggeraction on the control npc
__________________
LiquidIce *Owner* (UnholyNation)
-UN Website
http://www.unholynation.com
-UN Forum
http://forums.unholynation.com
-
-the thinker
-

-
onwall2 for nonp2p (i suck at onwall)
Reply With Quote
  #18  
Old 09-28-2001, 12:31 AM
Falcor Falcor is offline
Darth Cucumber
Falcor's Avatar
Join Date: Mar 2001
Location: At School
Posts: 2,874
Falcor is on a distinguished road
Send a message via ICQ to Falcor Send a message via AIM to Falcor Send a message via MSN to Falcor Send a message via Yahoo to Falcor
i MENT DIRECTLY. lIEK WITH SETLEVEL AND SETLEVEL2.
__________________

subliminal message: 1+1=3
Reply With Quote
  #19  
Old 09-28-2001, 12:45 AM
Sep3kP2P Sep3kP2P is offline
Registered User
Join Date: Aug 2001
Location: CT
Posts: 183
Sep3kP2P is on a distinguished road
Send a message via ICQ to Sep3kP2P Send a message via AIM to Sep3kP2P
read the warpers thread
__________________
Sephiroth2k - Co-Owner Of Dragon Quest (Look In Profile For Website)
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:44 AM.


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