Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #16  
Old 12-05-2009, 10:40 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Quote:
Originally Posted by Switch View Post
Yes since it'd still include "weapon", right? But I get what you were trying to do.
o_O

Start = 6, so ommitting the 'weapon' prefix.
End = length - 4; omitting the '.txt' suffix.
Reply With Quote
  #17  
Old 12-05-2009, 11:52 PM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
Quote:
Originally Posted by Codein View Post
Start = 6, so ommitting the 'weapon' prefix.
End = length - 4; omitting the '.txt' suffix.
Never knew the second param in substring() took off whatever the first param didn't include.
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
  #18  
Old 12-06-2009, 02:54 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Switch View Post
Never knew the second param in substring() took off whatever the first param didn't include.
How substring works:

"testingfoobarbaz".substring(3, 5)

It starts at 3, so it excludes the red

tes
tingfoobarbaz


Then it will extract the text between starting index 3 and the length from this index.

tes
tingfoobarbaz


The text inbetween the colored text is what you end up with
__________________
Reply With Quote
  #19  
Old 12-06-2009, 06:38 PM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
Quote:
Originally Posted by Chompy View Post
explanation
Yes I know how substrings work, I just didn't know if you had something like
PHP Code:
temp.string "Hi my name is Frank!";
echo(
temp.string.substring(14temp.string.length()-1); 
Would return "Frank" and not "Frank!" (not sure if there'd be 0's or spaces on the end, either) since the full length is 20 but it gets reduced down to 6, then taking 1 from that gives 5, which is enough for "Frank" without the "!"
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
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 03:58 AM.


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