Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-20-2006, 04:11 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
string manipulation

#T and #e I've read how the wiki says to use them, but I can't get it right x_X
PHP Code:
//GS1
if (startswith(coat,#c))
  
{
  
setplayerprop #c(1),#T(#e(4,-1,#c));
  
}
//my gs2 nightmare
if(str.starts("coat"))
  {
    
player.colors[1]=??????????
  } 
Reply With Quote
  #2  
Old 03-20-2006, 04:32 AM
Maniaman Maniaman is offline
Registered User
Join Date: Aug 2005
Posts: 326
Maniaman is on a distinguished road
Hmm, I am not sure, but you might try
NPC Code:

player.colors[1]=player.chat.trim(player.chat.substring(4,-1));

__________________

Current Maloria Event: (click to go to it)
Reply With Quote
  #3  
Old 03-20-2006, 04:58 AM
Riot Riot is offline
Delteria Management
Join Date: Nov 2003
Location: Seminole County, Florida
Posts: 280
Riot is on a distinguished road
Quote:
Originally Posted by Maniaman
Hmm, I am not sure, but you might try
NPC Code:

player.colors[1]=player.chat.trim(player.chat.substring(4,-1));

player.chat.substring(4).trim();
Reply With Quote
  #4  
Old 03-20-2006, 09:30 PM
Ajira Ajira is offline
Poont.
Join Date: Oct 2004
Location: NY, USA
Posts: 477
Ajira is on a distinguished road
You are also just doing
PHP Code:
if (str.starts("coat")) 
To check that the player actually says 'coat' first, do
PHP Code:
if (player.chat.starts("coat")) 
__________________
Liek omigosh.

Reply With Quote
  #5  
Old 03-21-2006, 10:01 AM
lancelot9 lancelot9 is offline
Registered User
lancelot9's Avatar
Join Date: May 2004
Posts: 618
lancelot9 is on a distinguished road
Welll. Ok here it goes.

First of all the T-3a scriptline and the T-4c SL are interlocked with eachother, this means you have to devide them with a sub script line (such as a simple action command), like you split them apart. Its kinda like shoe strings, you cant walk with both foot's shoes strings tied together, so you tie them seperatly.

PHP Code:
//GS1
if (startswith(coat,#c))
{
if (playerenters) {
playlooped fire-torch2.wav; > (Sub SL)
}

setplayerprop #c(1),#T(#e(4,-1,#c));
if (created) {
y=56.6;
setcoloreffect 0,1,0,0.2;
drawaslight;
}!!(7x(4x+5=3+2x))x a+b=c/Dtall;[Alphatest]
}

//my gs2 nightmare
if(str.starts("coat"))
{
player.colors[1]=??????????
}

Second I have no idea what im talking about
Reply With Quote
  #6  
Old 03-21-2006, 03:15 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by lancelot9
Welll. Ok here it goes.

First of all the T-3a scriptline and the T-4c SL are interlocked with eachother, this means you have to devide them with a sub script line (such as a simple action command), like you split them apart. Its kinda like shoe strings, you cant walk with both foot's shoes strings tied together, so you tie them seperatly.

PHP Code:
//GS1
if (startswith(coat,#c))
{
if (playerenters) {
playlooped fire-torch2.wav; > (Sub SL)
}

setplayerprop #c(1),#T(#e(4,-1,#c));
if (created) {
y=56.6;
setcoloreffect 0,1,0,0.2;
drawaslight;
}!!(7x(4x+5=3+2x))x a+b=c/Dtall;[Alphatest]
}

//my gs2 nightmare
if(str.starts("coat"))
{
player.colors[1]=??????????
}

Second I have no idea what im talking about
Hrm, try to use code blocks for things like that. And also, in your gscript1 version of it, you should not be using code outside event blocks.

PHP Code:
if(player.chat.starts("coat")) {
  
player.colors[1] = player.chat.substring("coat".length(), -1).trim();

__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #7  
Old 03-21-2006, 10:03 PM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
Quote:
Originally Posted by lancelot9
Welll. Ok here it goes.

First of all the T-3a scriptline and the T-4c SL are interlocked with eachother, this means you have to devide them with a sub script line (such as a simple action command), like you split them apart. Its kinda like shoe strings, you cant walk with both foot's shoes strings tied together, so you tie them seperatly.

PHP Code:
//GS1
if (startswith(coat,#c))
{
if (playerenters) {
playlooped fire-torch2.wav; > (Sub SL)
}

setplayerprop #c(1),#T(#e(4,-1,#c));
if (created) {
y=56.6;
setcoloreffect 0,1,0,0.2;
drawaslight;
}!!(7x(4x+5=3+2x))x a+b=c/Dtall;[Alphatest]
}

//my gs2 nightmare
if(str.starts("coat"))
{
player.colors[1]=??????????
}

Second I have no idea what im talking about
This makes me miss Excalibur.
Reply With Quote
  #8  
Old 03-21-2006, 11:20 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
soooo why doesn't this work?
PHP Code:
if (player.chat.starts("/skin"))
  {
    
player.colors[0] = player.chat.substring(4).trim();
  } 
Reply With Quote
  #9  
Old 03-21-2006, 11:55 PM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
... Because /skin is 5 characters long.
If you include the space, 6 characters long.
Reply With Quote
  #10  
Old 03-22-2006, 03:22 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by Yen
... Because /skin is 5 characters long.
Haha.
Quote:
Originally Posted by Yen
If you include the space, 6 characters long.
.trim() truncates leading and following spaces.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #11  
Old 03-22-2006, 05:55 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Quote:
Originally Posted by ApothiX
Haha.
ya ha ha x_X tha actual problem was earlier in the script, bu yeah, i missed that too I was hoping this thread would curl up and die after that, so no one would know about it XD
Reply With Quote
  #12  
Old 03-22-2006, 09:03 PM
Warcaptain Warcaptain is offline
Banned
Warcaptain's Avatar
Join Date: Jun 2001
Location: Virginia, USA
Posts: 2,086
Warcaptain is on a distinguished road
Send a message via ICQ to Warcaptain Send a message via AIM to Warcaptain Send a message via Yahoo to Warcaptain
Also in substring() you need to tell it how long as well.

NPC Code:

player.colors[0] = player.chat.substring(4,-1).trim();

Reply With Quote
  #13  
Old 03-22-2006, 09:34 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by Warcaptain
Also in substring() you need to tell it how long as well.

NPC Code:

player.colors[0] = player.chat.substring(4,-1).trim();

In new gscript, you do not need to specify a second parameter for substring() if you only want to specify an offset and continue to the end of the string.
PHP Code:
player.colors[0] = player.chat.substring(4).trim(); 
... is perfectly acceptable.
__________________
Skyld
Reply With Quote
  #14  
Old 03-22-2006, 11:02 PM
Warcaptain Warcaptain is offline
Banned
Warcaptain's Avatar
Join Date: Jun 2001
Location: Virginia, USA
Posts: 2,086
Warcaptain is on a distinguished road
Send a message via ICQ to Warcaptain Send a message via AIM to Warcaptain Send a message via Yahoo to Warcaptain
oh, my bad.

well thats great
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 10:22 AM.


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