Unknown2005-10-02 05:13:25
Okay, I'm fairly new to tinyfugue. I can do basic things like simple aliases or macros, but not much else. Anywho, what I'm looking for is something that'll check IR and take all the herbs and whatnot and tell me which herbs I'm under 20 in. If someone could point me in the right direction, It'd be great. Thanks!
Morik2005-10-02 10:02:15
ok. This is a tutorial in multiple parts.
Firstly, you need to understand what you're asking. The best way to do that is by looking at IR:
Glancing into the Rift, you see:
amethyst arnica beryl
bloodstone bluetint calamus
chervil cloth coal
colewort coltsfoot coral
emerald faeleaf flax
galingale garnet gold
goldtint greentint horehound
Type MORE to continue reading. (37% shown)
Secondly, you want to identify what you're trying to grab - in this case, names and values
of herbs.
Thirdly, how you're going to represent this all.
I'm going to do this:
* I'm going to write something which lets me store the value of each herb into a variable named
'count_rift_{riftitem}'. We can then write something to loop over this list of variables and search for ones under 20. What you could do is put the search in with the triggers but that means your display will be cluttered with alternating lines of rift output and your warnings.
Firstly, functions:
/def clear_rift_count = /quote -S /unset `/listvar -s count_rift_*
/def add_rift_count = /test count_rift_%1 := %2
These two functions let us set a rift count and clear the list of variables that start with count_rift_. To understand that, try /listvar .. which will spam you. Then try /listvar a* - which will give you all the variables starting with 'a' and their contents. /listvar -s will give you just the variable name, rather than the name and value. /quote -S lets us iterate over the list returned by /listvar and for each line it returns run a command - in this case, we run /unset on each of the values returned by /listvar -s count_rift_* .
Next, we look at the triggers. We know what the data looks like. It'll either be:
(rift item)
or
(item) (item)
or
(item) (item) (item)
Now. We could try to write something tricky to break the line apart and take note of each pair of number/items, but thats a pain. What we want is three triggers to match on the above:
(posting this bit so I don't lose the post body somehow.)
Firstly, you need to understand what you're asking. The best way to do that is by looking at IR:
Glancing into the Rift, you see:
amethyst arnica beryl
bloodstone bluetint calamus
chervil cloth coal
colewort coltsfoot coral
emerald faeleaf flax
galingale garnet gold
goldtint greentint horehound
Type MORE to continue reading. (37% shown)
Secondly, you want to identify what you're trying to grab - in this case, names and values
of herbs.
Thirdly, how you're going to represent this all.
I'm going to do this:
* I'm going to write something which lets me store the value of each herb into a variable named
'count_rift_{riftitem}'. We can then write something to loop over this list of variables and search for ones under 20. What you could do is put the search in with the triggers but that means your display will be cluttered with alternating lines of rift output and your warnings.
Firstly, functions:
/def clear_rift_count = /quote -S /unset `/listvar -s count_rift_*
/def add_rift_count = /test count_rift_%1 := %2
These two functions let us set a rift count and clear the list of variables that start with count_rift_. To understand that, try /listvar .. which will spam you. Then try /listvar a* - which will give you all the variables starting with 'a' and their contents. /listvar -s will give you just the variable name, rather than the name and value. /quote -S lets us iterate over the list returned by /listvar and for each line it returns run a command - in this case, we run /unset on each of the values returned by /listvar -s count_rift_* .
Next, we look at the triggers. We know what the data looks like. It'll either be:
(rift item)
or
(item) (item)
or
(item) (item) (item)
Now. We could try to write something tricky to break the line apart and take note of each pair of number/items, but thats a pain. What we want is three triggers to match on the above:
(posting this bit so I don't lose the post body somehow.)
Morik2005-10-02 10:12:54
ok, the first trigger:
/def -mregexp -p250 -t"^ \\*)] (*)$" trig_rift_1 = /add_rift_count %P2 %P1
This matches just the case where the rift line has one entry.
The next trigger:
/def -mregexp -p249 -t"^ \\*)] (*) *\\*)] (*)$" trig_rift_2 = /add_rift_count %P2 %P1 %; /add_rift_count %P4 %P3
This matches just the case where the rift line has two entries.
Then, to match all three:
/def -mregexp -p248 -t"^ \\*)] (*) *\\*)] (*) *\\*)] (*)$" trig_rift_3 = /add_rift_count %P2 %P1 %; /add_rift_count %P4 %P3 %; /add_rift_count %P6 %P5
Now, the spaces are important. You need the spaces in these regular expressions becuase they quite literally mean "match on space".
/def -mregexp -p250 -t"^ \\*)] (*)$" trig_rift_1 = /add_rift_count %P2 %P1
This matches just the case where the rift line has one entry.
The next trigger:
/def -mregexp -p249 -t"^ \\*)] (*) *\\*)] (*)$" trig_rift_2 = /add_rift_count %P2 %P1 %; /add_rift_count %P4 %P3
This matches just the case where the rift line has two entries.
Then, to match all three:
/def -mregexp -p248 -t"^ \\*)] (*) *\\*)] (*) *\\*)] (*)$" trig_rift_3 = /add_rift_count %P2 %P1 %; /add_rift_count %P4 %P3 %; /add_rift_count %P6 %P5
Now, the spaces are important. You need the spaces in these regular expressions becuase they quite literally mean "match on space".
Morik2005-10-02 10:19:30
ok, so finally:
type /clear_rift_count
then, IR, and MORE until all your rift is done
then /listvar count_rift_*
All of your riftable items are now in this list. What you now need to do is echo whenever its under 20. You can do this however you like - either by checking that list and spitting out which entries are under 20, or just doing the test inside the macro which is called by the triggers.
Note:
* This stuff has been just tested by me whilst harvesting
* It won't tell you when you have NONE of an item! Thats another problem entirely. You can always ask me about that one.
The answer to the second would be something like this:
You know you have an item when /add_rift_count is called. So what you want to do is have a list of all the items you want to check for having none of, REMOVE it when you see it in /add_rift_count, then check this list of items again afterwards to see whats back. My idea would be:
/def init_check_list = /set missing_yarrow=1 %; /set missing_chervil =1 %; /set missing_marjoram=1
/def add_rift_count = /test count_rift_%1 := %2 %; /test missing_%2=0
So, do:
/clear_rift_count
IR, (MOREing where appropriate)
then
/listvar count_rift_*
/listvar missing_*
and anything which has missing_{blah} set to 1 is what you're missing.
I hope thats enogh to get started. I didn't want to give you everything, mainly because you're going to need to learn how to script in tinyfugue sometime and so its best you get into it now. Hopefully I"ve given you enough of a starter to walk the right path. Bwbettin and I are seasoned Tinyfugue scripters so don't be afraid to ask questions here.
type /clear_rift_count
then, IR, and MORE until all your rift is done
then /listvar count_rift_*
All of your riftable items are now in this list. What you now need to do is echo whenever its under 20. You can do this however you like - either by checking that list and spitting out which entries are under 20, or just doing the test inside the macro which is called by the triggers.
Note:
* This stuff has been just tested by me whilst harvesting
* It won't tell you when you have NONE of an item! Thats another problem entirely. You can always ask me about that one.
The answer to the second would be something like this:
You know you have an item when /add_rift_count is called. So what you want to do is have a list of all the items you want to check for having none of, REMOVE it when you see it in /add_rift_count, then check this list of items again afterwards to see whats back. My idea would be:
/def init_check_list = /set missing_yarrow=1 %; /set missing_chervil =1 %; /set missing_marjoram=1
/def add_rift_count = /test count_rift_%1 := %2 %; /test missing_%2=0
So, do:
/clear_rift_count
IR, (MOREing where appropriate)
then
/listvar count_rift_*
/listvar missing_*
and anything which has missing_{blah} set to 1 is what you're missing.
I hope thats enogh to get started. I didn't want to give you everything, mainly because you're going to need to learn how to script in tinyfugue sometime and so its best you get into it now. Hopefully I"ve given you enough of a starter to walk the right path. Bwbettin and I are seasoned Tinyfugue scripters so don't be afraid to ask questions here.
Morik2005-10-02 10:24:46
places to visit:
www.bwbettin.com - bwbettins' scripting
www.cacheboy.net/achaea/tinyfugue/ - my little tinyfugue scripting FAQ corner
www.bwbettin.com - bwbettins' scripting
www.cacheboy.net/achaea/tinyfugue/ - my little tinyfugue scripting FAQ corner
Unknown2005-10-02 16:12:42
QUOTE(morik @ Oct 2 2005, 05:24 AM)
www.bwbettin.com - bwbettins' scripting
197302
Yay, I have fans!
Also, Nine Breaker (Gerald) is a good TF scripter. He's done some nifty work on curing systems and such.
Unknown2005-10-02 16:54:45
QUOTE(bwbettin @ Oct 2 2005, 11:12 AM)
Yay, I have fans!Â
Also, Nine Breaker (Gerald) is a good TF scripter. He's done some nifty work on curing systems and such.
Also, Nine Breaker (Gerald) is a good TF scripter. He's done some nifty work on curing systems and such.
197401
Why thanks you. And my system gets better everyday as I die more and more.
Alger2005-10-02 23:04:35
MORE DEATHS THEN!