 |
nexela Wizard

Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Thu Apr 19, 2007 5:37 am
[1.28] Regex calls seems to foobar cmud |
Subject - Dual regex calls seem to fail in certain cases, the only way to fix it is to re-open cmud. I can't think of any thing that I am doing wrong
1. Open cmud hit esc to get a blank session
2. Create this trigger via the command line
| Code: |
#TRIGGER {THIS (*) THAT(*)} {
$locatelist="Aginor|Arkenstone|Arturo|Augustus|Barabas|Clutch|Crowe|Deathstalker|Eva|Executioner|Gail|Harkon|Herbert|Hunter_Rose|Kiera|Killer|K'mala|Lori|Malorn|Many|Matrix|Mercenary|Morphine|Nothing|Ramadan|Sansaria|Sylia|wind-tanned"
$string={%expandlist(%sort(%delitem("wind-tanned",$locatelist)),", ")}
$target=@noTitle( %1)
#LOCAL $count $item
#CALL %regex( %trim( %lower( %2)), "(\d+\.)?(\S+)",$count,$item)
// $item=%trim(%2)
#SAY Count $count Item $item
#IF ($item="mercenary") {$item="wind-tanned"}
#SWITCH 1
(!$item) {
$msg="For |1175|U99 coins I can locate one of the following mobs Just ask me locate <mobname>: "
$string=$msg+$string
#SAY $string
#WHILE (%len( $string)>200) {
#CALL %regex(%left($string, 200), ".+[ ]", $pos)
talk $target %left( $string, $pos-2)
$string={%right( $string, $pos)}
#WAIT 1000
}
Talk $target $string
}
(!%ismember( $item, %lower( $locatelist))) {
$msg="That mob is not available for a locate try one of these: "
$string=$msg+$string
#WHILE (%len( $string)>200) {
#CALL %regex(%left($string, 200), ".+[ ]", $pos)
talk $target %left( $string, $pos-2)
$string={%right( $string, $pos)}
#WAIT 1000
}
Talk $target $string
}
(1) {#SAY GOOD GOOD}
} |
this trigger splits up a long list and returns strings less than 200 chars each when %2 is blank or %2 isn't member of the list (the #WAITS are there to keep cmud from endlessly looping in the #WHILE and freezing cmud when it fails)
3.#ECHO THIS zugg THAT
The output is correct with 2 lines from the 1'st #SWITCH expression
4. #ECHO THIS Zugg THAT malorn
The Output is Correct (GOOD GOOD is displayed) Third #SWITCH expression
5. #ECHO THIS Zugg THAT Notinlist
Starts endlessly looping #ABORT 1 to get out of it. This is from the second #SWITCH expression which is exactly the same as the first code wise only the $msg part is differant
6. #ECHO THIS Zugg THAT
(Step 3 again)
It starts endlessly looping #ABORT 1 to get out of it.
7. Comment out the first regex call and Uncomment the $item call under it. And save it.
//#CALL %regex( %trim( %lower( %2)), "(\d+\.)?(\S+)",$count,$item)
$item=%trim(%2)
8. Try Steps 3 and 5 again both still endlessly loop
9. restart Cmud and enter the script again and make the changes from Step 7
10. repeat steps 3 4 5 they will all work correctly |
|
|
|
 |
Tech GURU

Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Thu Apr 19, 2007 10:01 am |
Weird, but confirmed.
|
|
_________________ Asati di tempari! |
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Thu Apr 19, 2007 5:10 pm |
Wierd, but added to bug list.
|
|
|
|
 |
|
|
|
|
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
|
|