Author Topic: strings  (Read 5583 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
strings
« on: November 16, 2012, 11:53:24 AM »
0
checked the tutorials here and there wasn't one... checked easy uo and they were too simple.

how do i separate lines in a string after i event property a multi-line item.  id love to just make a string out of the first line only.

is there some way to do it with the $?

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13303
  • Activity:
    0.4%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: strings
« Reply #1 on: November 16, 2012, 03:12:53 PM »
0
you can use my split string subs for that.

http://www.scriptuo.com/index.php?topic=1101.msg8823#msg8823

Then you just use the "$" as the delimiter:

Code: [Select]
set %test_string THIS$IS$A$TEST$
gosub TM_SplitString %test_string $
gosub TM_SubstringCount
set %count #RESULT - 1
for %i 0 count
{
  gosub TM_GetIndex %i
  display OK %i , #SPC , #RESULT
}
stop
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline NObama

  • Everything I need to know, I learned from Miffy's Item Finder.
  • Elite
  • *
  • *
  • Posts: 3454
  • Activity:
    0%
  • Reputation Power: 43
  • NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.
  • Respect: +161
  • Referrals: 2
    • View Profile
Re: strings
« Reply #2 on: November 16, 2012, 03:18:37 PM »
0
TM HAS A SUB FOR EVERYTHING!

(It's like he seeds these threads so we can boggle at his awesomeness)

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: strings
« Reply #3 on: November 16, 2012, 03:23:51 PM »
0
alright... I'll check it out.  first glance it makes my head hurt.  there isnt a simple command to take character one up to the $ i guess.

Offline freddy

  • Sr. Member
  • *
  • Posts: 271
  • Activity:
    0%
  • Reputation Power: 4
  • freddy has no influence.
  • Gender: Male
  • Respect: +37
  • Referrals: 1
    • View Profile
Re: strings
« Reply #4 on: November 16, 2012, 06:05:24 PM »
0
check out my snippet here: http://www.scriptuo.com/index.php?topic=8886.msg77353#msg77353

you would do something like this:

event property %itemid
gosub separate_string #property $ ($ is the delimiter in this situation - my sub can handle any character as the delimiter)

%return1 would be the first line of text before the $


Edit:i failed to read trailmyx's post. looks like our subs do the same thing
« Last Edit: November 16, 2012, 06:08:47 PM by freddy »

Offline Guinness

  • Full Member
  • ***
  • Posts: 103
  • Activity:
    0%
  • Reputation Power: 3
  • Guinness has no influence.
  • Gender: Male
  • Crafting Your Wears Since 97
  • Respect: +7
  • Referrals: 4
    • View Profile
    • UO New Beginnings
Re: strings
« Reply #5 on: November 16, 2012, 10:00:06 PM »
0
lol....Honestly, why else would he have this site if it were not for his *Flashing AWESOMENESS Flashing*


Brought to you by
Twinkies
Oh *bleep*
Bye Bye Twinkies
Community Experience Manager
LIVE Streaming Pros
Guinness Of Atlantic
Owner Of UONewBeginnings

Offline manwinc

  • Elite
  • *
  • *
  • Posts: 2556
  • Activity:
    0%
  • Reputation Power: 32
  • manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!
  • Gender: Male
  • "The Devs Hard at Work"
  • Respect: +123
  • Referrals: 1
    • View Profile
Re: strings
« Reply #6 on: November 17, 2012, 07:43:22 AM »
0
Event Property (id)
Str Pos #Property $ 1
Str Left #Property #strres
Display #Strres
Halt
Monkeys and Typewriters!

" Oh I know, We'll make a Boss Encounter that requires 3 keys per player to enter, Then we'll make it not a closed instance so you never know if you are going to pop into a fresh room or a boss that has 1% Health left with 20 dudes smashing its face in, wasting your time and effort"

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: strings
« Reply #7 on: November 17, 2012, 12:59:45 PM »
0
Event Property (id)
Str Pos #Property $ 1
Str Left #Property #strres
Display #Strres
Halt

That was the basis of what I needed to learn.  That wasn't in the tutorials that I read.  Thank you everyone!

Offline manwinc

  • Elite
  • *
  • *
  • Posts: 2556
  • Activity:
    0%
  • Reputation Power: 32
  • manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!
  • Gender: Male
  • "The Devs Hard at Work"
  • Respect: +123
  • Referrals: 1
    • View Profile
Re: strings
« Reply #8 on: November 17, 2012, 01:27:20 PM »
0
He asked how to do it. NOT HOW TO USE EVERYONE ELSES SUBS TO DO IT! *Cries*

Lol
Monkeys and Typewriters!

" Oh I know, We'll make a Boss Encounter that requires 3 keys per player to enter, Then we'll make it not a closed instance so you never know if you are going to pop into a fresh room or a boss that has 1% Health left with 20 dudes smashing its face in, wasting your time and effort"

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13303
  • Activity:
    0.4%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: strings
« Reply #9 on: November 17, 2012, 01:42:53 PM »
0
heh, yeh I didn't catch that when I first read it for some reason.... 
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline Endless Night

  • Global Moderator
  • *
  • *
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +393
  • Referrals: 1
    • View Profile
Re: strings
« Reply #10 on: November 17, 2012, 01:54:04 PM »
0

I guess its to late to throw my version of these subs out thier then .. dam .. late for the party once again.
Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Offline manwinc

  • Elite
  • *
  • *
  • Posts: 2556
  • Activity:
    0%
  • Reputation Power: 32
  • manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!
  • Gender: Male
  • "The Devs Hard at Work"
  • Respect: +123
  • Referrals: 1
    • View Profile
Re: strings
« Reply #11 on: November 17, 2012, 02:01:12 PM »
0
ahahahaha, Its good to see the Community whipping out what they've got whenever someone asks for help. Wait.....
Monkeys and Typewriters!

" Oh I know, We'll make a Boss Encounter that requires 3 keys per player to enter, Then we'll make it not a closed instance so you never know if you are going to pop into a fresh room or a boss that has 1% Health left with 20 dudes smashing its face in, wasting your time and effort"

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: strings
« Reply #12 on: November 17, 2012, 08:54:05 PM »
0
Yeah, I am psyched so many folks jumped in.  I need to learn strings in more depth.  i've only used them in basic form.  thx again all!

Offline manwinc

  • Elite
  • *
  • *
  • Posts: 2556
  • Activity:
    0%
  • Reputation Power: 32
  • manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!
  • Gender: Male
  • "The Devs Hard at Work"
  • Respect: +123
  • Referrals: 1
    • View Profile
Re: strings
« Reply #13 on: November 17, 2012, 10:52:41 PM »
0
Yeah,


str len (String)
-> sets #Strres to the Length of the String

str Count (String) (Sub String)
-> sets #Strres to the # of Sub Strings in the String ; so if you Did a count of the # of "resist" in The property of  Most armor, it would return 5

Str Pos (String) (Sub String) (Index)
-> Sets #Strres to the Numeric Location of the Indexed Sub String.
Str Pos _This_ _ 2 ; Would Find the Location of the Second _ in the String "_This_ "
Str Pos is Usually used in Conjunction with  Str Count to determine how many instances or to Increment the Index's

Str Left (String) (Length)
-> Sets #Strres to the Part of the String from 1 to "Length"
Str Left This 2
-> #Strres = Th


Str Right (String) (Length)
-> Sets #Strres to the part of the String from the End in (Length) distance
Str Right This 2
-> #Strres = is

Str Mid (String) (Start) (Length)
-> Sets #Strres to the Part of the string from the Start to Start + Length
Str Right and Str Left become obsolete as you learn to use Str Mid

Str Lower (String)
-> Turns Penguins into llamas. Or Something like that... Honestly Never Used it. I'd Imagine it Forces everything to Lower Case

Str Ins (String) (Sub String) (Start)
-> Inception of a string inside a string.....

Str Del (String) (Start) (Length)
-> Sets #Strres to the Leftover String after you Chop it into Pieces

Those are all the Commands Described in a fairly basic way....

Some Handy Pointers when it comes to handling Property Strings.

#Property isn't the same as Journal. You don't have _ instead of Spaces. Instead you have actual Spaces. So Physical Resist becomes Physical , #Spc , Resist in EUO.

Learn to Use Str Count, Str Pos, Str Mid and you can Pull just about any Data you want out of a string.
Monkeys and Typewriters!

" Oh I know, We'll make a Boss Encounter that requires 3 keys per player to enter, Then we'll make it not a closed instance so you never know if you are going to pop into a fresh room or a boss that has 1% Health left with 20 dudes smashing its face in, wasting your time and effort"

Offline NObama

  • Everything I need to know, I learned from Miffy's Item Finder.
  • Elite
  • *
  • *
  • Posts: 3454
  • Activity:
    0%
  • Reputation Power: 43
  • NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.
  • Respect: +161
  • Referrals: 2
    • View Profile
Re: strings
« Reply #14 on: November 18, 2012, 12:15:14 PM »
0
Also:

Str Hokey Pokey
Where you turn it all around

Tags: