Xiel2009-11-06 22:47:00
Alright, so, it's no secret that I'm programming challenged, and thus I turn to the almighty forum-folk to help me a bit with a wee little Cooking system if they'd be so kind as to show me..how, exactly, I could get it to work.
As it stands, the amount of Cooking commodities can change depending on the recipe, and typing out OUTR number blah five or six times for one recipe gets dull. Would there be any possible means of making a little alias (let's say COOKGO) which would pull up the info as varying as this or this:
And it'd OUTR the the commodities needed to create the recipe? Pulling up that information requires the syntax RECIPE , and I think I can get that pretty much down I think, but I've no idea how to trigger the line going Ingredients since the number and amount changes so much. Help, plz?
As it stands, the amount of Cooking commodities can change depending on the recipe, and typing out OUTR number blah five or six times for one recipe gets dull. Would there be any possible means of making a little alias (let's say COOKGO) which would pull up the info as varying as this or this:
CODE
You carefully study a cooking recipe.
Item: Rice  Type: Dishes  Org: Shadowfeast
Ingredients: poultry 2 spices 2 grain 1
IMPORTANT: The main noun of this item MUST use this name: RICE
Appearance:
spiced chicken and rice
Etc.
OR
You carefully study a cooking recipe.
Item: Wine  Type: Wine  Org: Shadowfeast
Ingredients: fruit 4 spices 1 honeycomb 1 sugar 1 faeleaf 1
IMPORTANT: The main noun of this item MUST use this name: WINE
Appearance:
a fragrant white wine
Etc.
Item: Rice  Type: Dishes  Org: Shadowfeast
Ingredients: poultry 2 spices 2 grain 1
IMPORTANT: The main noun of this item MUST use this name: RICE
Appearance:
spiced chicken and rice
Etc.
OR
You carefully study a cooking recipe.
Item: Wine  Type: Wine  Org: Shadowfeast
Ingredients: fruit 4 spices 1 honeycomb 1 sugar 1 faeleaf 1
IMPORTANT: The main noun of this item MUST use this name: WINE
Appearance:
a fragrant white wine
Etc.
And it'd OUTR the the commodities needed to create the recipe? Pulling up that information requires the syntax RECIPE
Ytran2009-11-06 23:15:29
#CLASS {Cooking}
#CLASS 0
#CLASS {Cooking|Outr}
#VAR temp {}
#VAR count {1}
#ALIAS get_ingredients {#T+ ingredients_trig trigger;insert proper syntax for checking a recipe here}
#REGEX "ingredients_trig" {^Ingredients\\:\\s+((?:\\w+ \\d+\\s?)+)$} {#T- ingredients_trig trigger;#VAR count {1};#VAR temp {%replace( "%1", " ", "|")};#WHILE ( @count < %numitems( @ingredients ) ) {outr %item( @temp, @count ) %item( @temp, %eval( @count + 1 );#ADD count 2};#VAR temp {}} "" "" {disable}
#CLASS 0
Something like ^ should work. Maybe. I haven't tested it, and wrote it off the top of my head.
EDIT: Fixed a bug.
EDIT 2: Shortened it up by a bit.
#CLASS 0
#CLASS {Cooking|Outr}
#VAR temp {}
#VAR count {1}
#ALIAS get_ingredients {#T+ ingredients_trig trigger;insert proper syntax for checking a recipe here}
#REGEX "ingredients_trig" {^Ingredients\\:\\s+((?:\\w+ \\d+\\s?)+)$} {#T- ingredients_trig trigger;#VAR count {1};#VAR temp {%replace( "%1", " ", "|")};#WHILE ( @count < %numitems( @ingredients ) ) {outr %item( @temp, @count ) %item( @temp, %eval( @count + 1 );#ADD count 2};#VAR temp {}} "" "" {disable}
#CLASS 0
Something like ^ should work. Maybe. I haven't tested it, and wrote it off the top of my head.
EDIT: Fixed a bug.
EDIT 2: Shortened it up by a bit.
Xiel2009-11-07 00:23:24
Yar, tried putting that into the folder stuff and when I checked the trigger, something's not being processed right.
Aison2009-11-07 00:30:01
Or buy Lendren's workbench, which is an amazing script.
Ytran2009-11-07 01:06:06
QUOTE (Xiel @ Nov 6 2009, 06:23 PM) <{POST_SNAPBACK}>
Yar, tried putting that into the folder stuff and when I checked the trigger, something's not being processed right.
You would save that in a text file and import.