Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
chris123zugg
Apprentice


Joined: 23 Aug 2013
Posts: 175

PostPosted: Sat Dec 23, 2017 12:02 am   

Help with capture
 
Deftness ........... 20 ( 10.72%)
i have tried this with no success, and im unclear how to strip the "." this or make the end work with digits, decimal, percent

this is what i tried:

(%w)%s*%s(%d)%s~(([0-9.])~%~)

any help would be appreciated
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Sat Dec 23, 2017 12:16 am   
 
try:

#TR {(%w) [.] (%d) ~( (%d.%d)%~)} {do stuff}
_________________
Discord: Shalimarwildcat
Reply with quote
chris123zugg
Apprentice


Joined: 23 Aug 2013
Posts: 175

PostPosted: Sat Dec 23, 2017 12:17 am   
 
hah, it works now, not sure what i didn't check before hand. i had to make 2 version though, one with a %s inside the last digit portion to capture pre-100

(%w)%s*%s(%d)%s~(%s([0-9.])~%~)

if there is a better or more efficient way to write this can someone please let me know. thanks!
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Sat Dec 23, 2017 12:35 am   
 
I would but the %s inside the [] and then %trim the results, might have an issue actually catching the 100's otherwise
_________________
Discord: Shalimarwildcat
Reply with quote
chris123zugg
Apprentice


Joined: 23 Aug 2013
Posts: 175

PostPosted: Sat Dec 23, 2017 12:50 am   
 
also it seems to be capturing the LAST in line which isn't working correctly as i want it to fire on first or second in line etc... ill show an example of the capture. here



Combat Skills: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Awe ................ 0 ( 0.06%) Block .............. 3 ( 35.78%)
Circle ............. 9 ( 42.00%) Divine strike ...... 10 ( 6.06%)
Engage ............. 18 ( 44.78%) Parry .............. 3 ( 43.17%)
Presage ............ 41 ( 18.00%) Void ............... 5 ( 35.83%)
Divinity Skills: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Aegis .............. 3 ( 38.89%) Consecrate ......... 0 ( 0.00%)
Disperse ........... 1 ( 20.00%) Fly ................ 0 ( 0.06%)
Manifest ........... 2 ( 63.06%) Radiance ........... 1 ( 20.22%)
Rites .............. 2 ( 92.78%) Scales ............. 0 ( 0.06%)
Shine .............. 0 ( 0.00%) Soar ............... 0 ( 0.00%)
Manifestations: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Beyond time ........ 0 ( 29.11%) Deva ............... 0 ( 0.00%)
Halo ............... 6 ( 8.00%) Renewed light ...... 0 ( 0.00%)
Wings .............. 3 ( 37.33%)

im considering using a multistate trigger but don't know how to script it to keep each skill/skill name, and fire to train each one that is at or above 100%

and thank you shalimar.
Reply with quote
chris123zugg
Apprentice


Joined: 23 Aug 2013
Posts: 175

PostPosted: Sat Dec 23, 2017 9:37 am   
 
#TR {Combat Skills: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- }
#cond (%w)%s*%s(%d)%s~(%s([0-9.])~%~)
#IF {%3=>100) {train %1}}

or something like that
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Sat Dec 23, 2017 7:03 pm   
 
Ah, two name skills exist, try:

#TR {([%w%s])[.]([%s%d])~(([%s%d.])~%~)} {
$name=%trim(%1)
$level=%trim(%2)
$percentage=%trim(%3)
#IF ($percentage>99.99) {train %lower($name)}
}

We want to avoid using * as that is greedy and will try to consume as much of a line as it possibly can, as much as:
.............. 3 ( 38.89%) Consecrate .........
[.] will more concisely grab any number of periods.

and make sure to check the repeat within line option
_________________
Discord: Shalimarwildcat
Reply with quote
chris123zugg
Apprentice


Joined: 23 Aug 2013
Posts: 175

PostPosted: Sat Dec 23, 2017 9:25 pm   
 
cool, i have never used %trim, does it just strip away all but alphanumeric?
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Sat Dec 23, 2017 10:53 pm   
 
it just strips away any whitespace padding to the let and right of a string
_________________
Discord: Shalimarwildcat
Reply with quote
chris123zugg
Apprentice


Joined: 23 Aug 2013
Posts: 175

PostPosted: Sat Dec 23, 2017 10:56 pm   
 
hrrrm cool
Reply with quote
chris123zugg
Apprentice


Joined: 23 Aug 2013
Posts: 175

PostPosted: Tue Dec 26, 2017 11:15 pm   
 
CL: [*49.22%] is a similar circumstance where i need the nnumbers in a variable as well as the asterisk in a variable

i used this: CL~:%s~[(*)~%~] OR CL~:%s~[0-9.)~%~]

the issue im having is when i use the spell connected to the asterisk it dissapears from that capture so i how do i make 1 capture to handle the asterisk being there or not?

thanks big big in advance!
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Tue Dec 26, 2017 11:51 pm   
 
Maybe?:

#TR {CL:%s~[({~*|})([%s%d.])~%~]} {
$value=%trim(%2)
#IF (!%null(%1)) {do something}
}
_________________
Discord: Shalimarwildcat
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net