|
agedmoon Newbie
Joined: 16 Nov 2003 Posts: 2
|
Posted: Sun Nov 16, 2003 5:33 am
Is it possible to write a triger for this case? |
Hi, folk
I receive such a message when playing mud:
©°©¤©¤©´©°©¤©¤©´©°©¤©¤©´
¡ö¡ö¡ö©¦¡ö¡ö¡ö©¦¡ö¡ö¡ö©¦
¡ö©¸¡ö©¦©°©¤¡ö©¦¡ö©¸¡ö©¦
¡ö¡ö¡ö©¦¡ö¡ö¡ö©¼¡ö¡ö¡ö©¦
©°©¤¡ö©¦¡ö©¤©¤©´©°©¤¡ö©¦
¡ö¡ö¡ö©¼¡ö¡ö¡ö©¼¡ö¡ö¡ö©¼
Is it possible to write a trigger to convert this piece of infomation
to its digital value 929? Ideally the trigger should be able to handle
all the numbers and any number of numbers of the same format...
Thank you very much!!!!!! |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sun Nov 16, 2003 7:18 pm |
It probably is possible if you know the formula and format involved.
|
|
|
|
TonDiening GURU
Joined: 26 Jul 2001 Posts: 1958 Location: Canada
|
Posted: Tue Nov 18, 2003 9:50 pm |
Code: |
©°©¤©¤©´©°©¤©¤©´©°©¤©¤©´
<font color="red">¡ö</font id="red"><font color="red">¡ö</font id="red"><font color="red">¡ö</font id="red">©¦<font color="red">¡ö</font id="red"><font color="red">¡ö</font id="red"><font color="red">¡ö</font id="red">©¦<font color="red">¡ö</font id="red"><font color="red">¡ö</font id="red"><font color="red">¡ö</font id="red">©¦
<font color="red">¡ö</font id="red">©¸<font color="red">¡ö</font id="red">©¦©°©¤<font color="red">¡ö</font id="red">©¦<font color="red">¡ö</font id="red">©¸<font color="red">¡ö</font id="red">©¦
<font color="red">¡ö</font id="red"><font color="red">¡ö</font id="red"><font color="red">¡ö</font id="red">©¦<font color="red">¡ö</font id="red"><font color="red">¡ö</font id="red"><font color="red">¡ö</font id="red">©¼<font color="red">¡ö</font id="red"><font color="red">¡ö</font id="red"><font color="red">¡ö</font id="red">©¦
©°©¤<font color="red">¡ö</font id="red">©¦<font color="red">¡ö</font id="red">©¤©¤©´©°©¤<font color="red">¡ö</font id="red">©¦
<font color="red">¡ö</font id="red"><font color="red">¡ö</font id="red"><font color="red">¡ö</font id="red">©¼<font color="red">¡ö</font id="red"><font color="red">¡ö</font id="red"><font color="red">¡ö</font id="red">©¼<font color="red">¡ö</font id="red"><font color="red">¡ö</font id="red"><font color="red">¡ö</font id="red">©¼
123456789012345678901234
|
A way would be to:
You'll need to capture each line.
Check out the length of each line and divide by 8 to see how many #s there are.
In this case, dividing by 8 gives you 3, you could copy from 1,8 9,17 18,24 for each line and make a long string for each 'number'
Compare that long string against a list to figure out what number it is.
So the second item in the list you would have a match for:
Code: |
©°©¤©¤©´
¡ö¡ö¡ö©¦
©°©¤¡ö©¦
¡ö¡ö¡ö©¼
¡ö©¤©¤©´
¡ö¡ö¡ö©¼
|
Would be represented as
©°©¤©¤©´¡ö¡ö¡ö©¦©°©¤¡ö©¦¡ö¡ö¡ö©¼¡ö©¤©¤©´¡ö¡ö¡ö©¼ |
|
|
|
agedmoon Newbie
Joined: 16 Nov 2003 Posts: 2
|
Posted: Wed Nov 19, 2003 7:55 pm |
Wow, Diening you are great! I will be able to write the trigger for this case now.
But one thing I do not know:
The message is displayed at one time, how can I store it as several lines?
Thank you very much!! |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Wed Nov 19, 2003 11:43 pm |
The first line seems to contain the same sequence for each number. You can trigger off that sequence ©°©¤©¤©´ with a multistate trigger. By counting the width of the first %line you will know exactly how to initialize your variables. Looplines with a param of 5 would be perfect. It would appear that only the first 6 characters of an 8 character ¡ö¡ö¡ö©¦
sequence matter. To acelerate conversion I would suggest 5 record variables (one for each pertainent line) with that 6 character portion set as keys, and a bitwise (ie 23567890 all should have a full bar so the final number would be 1005) list of numbers that have that pattern on that line as values. Then your first data line fills all the possibles and you can eliminate with each subsequent line. Probably by the 3rd line it would know what the number is.
Rough example:
#TR {^©°©¤©¤©´} {Digits=%eval(%len(%line)/8);ConvertedNumbers="";LCount=0;#PRIORITY {#LOOP @Digits {#ADDKEY ConvertedNumbers {%i} {1023}}}}
#COND {} {#ADD LCount 1;#PRIORITY {#LOOP @Digits {#ADDKEY ConvertedNumbers {%i} {%bitand(%db(@ConvertedNumbers,%i),%db(@{Line%i},%copy(%line,%eval(%i*8),6)))}}}} {looplines|param=5} |
|
|
|
|
|