Author Topic: string help plz  (Read 2444 times)

0 Members and 1 Guest are viewing this topic.

Offline _C2_Topic starter

  • AFK FtW
  • Global Moderator
  • *
  • *
  • Posts: 4077
  • Activity:
    0%
  • Reputation Power: 48
  • _C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!
  • RIP Pen Trick
  • Respect: +254
  • Referrals: 4
    • View Profile
string help plz
« on: November 06, 2010, 06:54:05 PM »
0
looking for a little help on strings.  i have never spent a ton of time with them and am more than rusty from what i use to be able to do with them...

looking for ideas on how to handle the new bobbers with the characters name in them.

I tried doing event property and then looking for #charname in property but that did not work at all when a character had two parts to their name.  The space does not show up the same way in the #property.

So, that leaves me to think i need to use strings to rework the name or pull the name part.

Currently, i have the user set %namepart by editting a few of the letters in their name.  ex if the name was Uber Noober... they would set %namepart uber  or set %namepart noob

Problem is many forget and then the script doesn't work for them becasue it doesnt see their name part in the bobber and it tries  replacing them all over and over.

so setting strings could take a name like uber noober and make it into this... uber_noober which could be seen in #property  or even taking the a section of the name... the tricky part is some names are shorter than others and/or many folks have lady/lord titles.

Any ideas or sample code would be appreciated and earn credits in code.

Scrripty

  • Guest
Re: string help plz
« Reply #1 on: November 06, 2010, 08:58:04 PM »
0
if oober , #spc , noober in #property?  Try that.

Offline _C2_Topic starter

  • AFK FtW
  • Global Moderator
  • *
  • *
  • Posts: 4077
  • Activity:
    0%
  • Reputation Power: 48
  • _C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!
  • RIP Pen Trick
  • Respect: +254
  • Referrals: 4
    • View Profile
Re: string help plz
« Reply #2 on: November 06, 2010, 09:45:02 PM »
0
if oober , #spc , noober in #property?  Try that.

that would be great for just me but I am looking for it to support all users.  What i have now works great for me too but users have to edit it in a section still.  i want users to have that as hands off

Scrripty

  • Guest
Re: string help plz
« Reply #3 on: November 06, 2010, 09:53:31 PM »
0
if oober , #spc , noober in #property?  Try that.

that would be great for just me but I am looking for it to support all users.  What i have now works great for me too but users have to edit it in a section still.  i want users to have that as hands off

Open their title menu and clear it? :)

Offline Dixie Wrecked

  • Full Member
  • ***
  • Posts: 124
  • Activity:
    0%
  • Reputation Power: 3
  • Dixie Wrecked has no influence.
  • Gender: Male
  • Respect: +31
  • Referrals: 1
    • View Profile
Re: string help plz
« Reply #4 on: November 06, 2010, 10:19:36 PM »
0
Here's something I whipped up which removes the Lord/Lady part of the name, then changes the spaces to underscores:

Code: [Select]
sub ConvertSpacesToUnderscores
set %name #charname
str count %name #spc
if #strRES = 0
  {
  return
  }
if Lord in %name || Lady in %name
  {
  str del %name 1 5 ; removes the first 5 chars, ie. Lord_ or Lady_
  set %name #strRES
  }

str count %name #spc
if #strRES = 0
  {
  return
  }
set %loop #strRES
for %i 1 %loop
  {
  str Pos %name #spc
  set %InsSpot #strRES
  set %DelSpot %InsSpot + 1
  str Ins %name _ %InsSpot ; #strRes = HELILO
  set %name #strRES
  str Del %name %DelSpot 1 ; #strRes = HEO
  set %name #strRES
  }
return

Hopefully that works or at least helps you out!!!
"hmm, theres no examples and directions sticky in new member intros.  you have to admit script library would have been a good place to put it"
- karrde

Offline _C2_Topic starter

  • AFK FtW
  • Global Moderator
  • *
  • *
  • Posts: 4077
  • Activity:
    0%
  • Reputation Power: 48
  • _C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!
  • RIP Pen Trick
  • Respect: +254
  • Referrals: 4
    • View Profile
Re: string help plz
« Reply #5 on: November 06, 2010, 10:30:18 PM »
0
that is basically what i am talking about!  that takes care of names with spaces.  i will look at that more tomorrow evening.  It could be used in a script to eliviate users need to add parts of their names

Tags: