Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-22-2011, 02:07 AM
Tricxta Tricxta is offline
The Muffin Man
Tricxta's Avatar
Join Date: Oct 2010
Location: Australia
Posts: 563
Tricxta is a jewel in the roughTricxta is a jewel in the rough
Just wondering if this is possible

Hey guys,

Im trying to learn GS2 now and im making some system that will read a string then spit out some data according to it.

So an example of what i'm trying to do is:

I want to get the information from a particular string but the program doesn't know what strings its going to receive so a predefined array is useless.

Graal Script Code:
clientr.some_weapon_ 
starts the string and this much I know, I also know that the weapon corresponding to the string ends with the same characters as the string.
So the weapon name could be weapons/bat and the string could be clientr.some_weapon_bat

So to construct the string I need I would do:
Graal Script Code:
temp.wname="bat";
temp.sname="clientr.some_" temp.wname
But now the actual problem... how would I tokenize the string to give me the value of client.some_weapon_bat ?

I've tried doing
Graal Script Code:
temp.wname="bat";
temp.sname="clientr.some_" temp.wname;
temp.tokens=temp.sname.tokenize(); 
But that didn't work... So is what i'm trying to do actually possible and if so how?
Reply With Quote
  #2  
Old 08-22-2011, 02:12 AM
Deas_Voice Deas_Voice is offline
Deas
Deas_Voice's Avatar
Join Date: Jun 2007
Location: Sweden
Posts: 2,264
Deas_Voice is a jewel in the roughDeas_Voice is a jewel in the rough
Send a message via AIM to Deas_Voice Send a message via MSN to Deas_Voice Send a message via Yahoo to Deas_Voice
it is possible, and is done all the time!

you would need to 'convert' the string into an 'object' eg;
Graal Script Code:
clientr.(@"some_" temp.wname); 
to tokenize it... (editing... please hold.)
edit; sorry, can't get my head to work, i guess i'm too tired for that, but i've done it before.
__________________
.
WTF is real life, and where do I Download it?
There is no Real Life, just AFK!
since 2003~
I Support~
ღAeonღ | ღTestbedღ | ღDelteriaღ

if you are going to rep me, don't be an idiot, leave your name!
I got nothing but love for you

Last edited by Deas_Voice; 08-22-2011 at 02:14 AM.. Reason: meh
Reply With Quote
  #3  
Old 08-22-2011, 02:19 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
Yep.

I.e:

Graal Script Code:
function onCreated() {
  
temp."sword";
  
temp.("example_" temp.w) = "a b c d e";
  
temp.tokens temp.("example_" temp.w).tokenize();
  echo(
temp.tokens);

__________________
Quote:
Reply With Quote
  #4  
Old 08-22-2011, 02:25 AM
Tricxta Tricxta is offline
The Muffin Man
Tricxta's Avatar
Join Date: Oct 2010
Location: Australia
Posts: 563
Tricxta is a jewel in the roughTricxta is a jewel in the rough
Wow, thank you very much for the quickly reply
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 12:18 PM.


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (C) 1998-2008 Linux cyberjoueurs All Rights Reserved.