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-07-2006, 10:29 PM
ChibiChibiLuc ChibiChibiLuc is offline
Cookie Monster. :3
Join Date: Jan 2005
Location: Nova Scotia, Canada
Posts: 111
ChibiChibiLuc is on a distinguished road
Send a message via AIM to ChibiChibiLuc Send a message via MSN to ChibiChibiLuc
String being trimmed when I don't want it to?

Due to a 'typo,' an item's name was set as 'Gold Platemail '
Notice the extra space at the end.
The string holding the number of Gold Platemail I have is set as 'Gold Platemail =3' in attributes. Notice the space again.

When the system goes to load the archetype of 'Gold Platemail,' it trims out the space even though I didn't tell it to. This causes a bug. The systems look for the stats of 'Gold Platemail ' but they're saved as 'Gold Platemail' so it doesn't find them.

I tried to make an NPC convert all 'Gold Platemail ' strings to 'Gold Platemail' but the NPC automatically trims the space off the end..

Any ideas?
Reply With Quote
  #2  
Old 09-07-2006, 11:05 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Try substring'ing it?
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #3  
Old 09-08-2006, 01:26 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
What script operation is trimming the string?
Reply With Quote
  #4  
Old 09-11-2006, 04:01 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Why don't you just rename the archetype? If it has an error in it's name like that it should be renamed anyway
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #5  
Old 09-11-2006, 08:56 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
That's the problem.
It automatically trims the space, so even if I rename the archetype to have a space it will be trimmed.

PHP Code:
  if (clientr.(@"item-Gold Platemail ").size() >= 1) {
    
clientr.(@"item-Gold Platemail") = {clientr.(@"item-Gold Platemail")[0] + clientr.(@"item-Gold Platemail ")[0],"armor/chest/goldplatemail"};
    
clientr.(@"item-Gold Platemail ") = "";
  } 

Last edited by Yen; 09-11-2006 at 09:19 PM..
Reply With Quote
  #6  
Old 09-12-2006, 12:51 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
I still don't understand where exactly your problem is, I would need to know when it is trimming your strings and when it is not.
Reply With Quote
  #7  
Old 09-12-2006, 02:52 AM
ChibiChibiLuc ChibiChibiLuc is offline
Cookie Monster. :3
Join Date: Jan 2005
Location: Nova Scotia, Canada
Posts: 111
ChibiChibiLuc is on a distinguished road
Send a message via AIM to ChibiChibiLuc Send a message via MSN to ChibiChibiLuc
To anyone still interested:
Stefan found out that you can find if the player has an instance of the string with the space (Gold Platemail ) by using getstringkeys("clientr.item-Gold Platemail").

After that, I figured out you can do something like this:
PHP Code:
temp.gpmstring "clientr.item-Gold Platemail ";
clientr.("item-Gold Platemail") = {makevar(temp.gpmstring)[0],"armor/chest/goldplatemail"}; 
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:21 PM.


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