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 07-19-2011, 03:50 AM
Astram Astram is offline
Era iPhone PR
Astram's Avatar
Join Date: Aug 2010
Posts: 324
Astram can only hope to improve
Send a message via AIM to Astram
Before Characters

I'm trying to make a gani set, but its from the ganis folder. I need to know how to do:
PHP Code:
temp.foo fly.gani;
setani(temp.foo,NULL); 
This is just an example of the situation im in. I just need help on how to removed the .gani suffix from a string. If anyone can help PLEASE do. I am loading it from a folder. So I cant really edit the string (I think).
__________________
-Toad
The worlds biggest Toad fan...
Era iPhone FTW!


Reply With Quote
  #2  
Old 07-19-2011, 03:59 AM
oo_jazz_oo oo_jazz_oo is offline
Jazz teh Awesome
oo_jazz_oo's Avatar
Join Date: Jul 2006
Location: California
Posts: 596
oo_jazz_oo is a jewel in the roughoo_jazz_oo is a jewel in the rough
Send a message via MSN to oo_jazz_oo
Quote:
Originally Posted by http://gscript.graal.net/substring
Usage
Syntax: string.substring(index[, length]);
Returns string.

Example
PHP Code:
function onCreated()
{
  
temp.foo "Hello World!";
  echo(
temp.foo.substring(1));
  echo(
temp.foo.substring(65));

This is a good starting point. If you know for a fact that the file being passed has .gani attached, you can just use substring. Otherwise, you might want to use a mix of http://gscript.graal.net/pos and substring.
__________________

Reply With Quote
  #3  
Old 07-19-2011, 04:05 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
You could use substring, but it's so much easier just to use:

extractfilebase(str) - Extracts the base file name from a string. I.e: levels/file.nw would return file.

Usage:

PHP Code:
function onCreated() {
  
temp.filename "fly.gani";
  
temp.gani extractfilebase(temp.filename);
  echo(
temp.gani); // echos: fly

__________________
Quote:
Reply With Quote
  #4  
Old 07-19-2011, 04:10 AM
Astram Astram is offline
Era iPhone PR
Astram's Avatar
Join Date: Aug 2010
Posts: 324
Astram can only hope to improve
Send a message via AIM to Astram
Quote:
Originally Posted by fowlplay4 View Post
You could use substring, but it's so much easier just to use:

extractfilebase(str) - Extracts the base file name from a string. I.e: levels/file.nw would return file.

Usage:

PHP Code:
function onCreated() {
  
temp.filename "fly.gani";
  
temp.gani extractfilebase(temp.filename);
  echo(
temp.gani); // echos: fly

Thanks fowlplay4. Thats pretty good.
__________________
-Toad
The worlds biggest Toad fan...
Era iPhone FTW!


Reply With Quote
  #5  
Old 07-19-2011, 04:15 AM
oo_jazz_oo oo_jazz_oo is offline
Jazz teh Awesome
oo_jazz_oo's Avatar
Join Date: Jul 2006
Location: California
Posts: 596
oo_jazz_oo is a jewel in the roughoo_jazz_oo is a jewel in the rough
Send a message via MSN to oo_jazz_oo
Didn't even know of that function. :o

Learn something new every day...
__________________

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 06:33 PM.


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