About Us
Products
Purchase
Downloads
Support
Forums
Contact Us
Site
 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
Guthrie
Beginner


Joined: 01 Dec 2011
Posts: 12

PostPosted: Thu Dec 01, 2011 5:21 pm   

How do I go about this project?
 
What I'd like to do is create a script that will in the end show me the following:

Average damage of my swings and my victims melee attacks.
Average damage of my fireballs and my victims fireballs.
Lowest to highest damage in range format (0-536 for example) shown for fireballs and melee attacks.

Keep track of the largest total amount of damage dealt in 1 round by both players. If any round where to exceed the previous round in total damage(melee and fireballs) I want this displayed at the end of the fight.



I'm really not sure how to go about setting this up. I was thinking maybe I could store multiple numbers in one variable. Not sure if that's possible and then have it sorted and displayed the way I want it to be. I just need a push in the right direction with this project.

I'll give you some mud output to look at.


Quote:
[2286657exp] {1am} <25000hp 25000m 25000> iGrizzliei lBl <100bl> kill tyron
You claw Tyron incredibly hard! (220)
Your fireball strikes Tyron extremely hard! (145)
You claw Tyron incredibly hard! (254)

[97] [98] {2am} Grizzlie 1B1 <24573hp 25000m 25000mv> [85] [2286657] drink rod

You claw Tyron incredibly hard! (243)
Tyron suddenly bursts into flames!

[93] [97] {2am} Grizzlie 1B1 <24328hp 25000m 24860mv> [80] [2286657]
Tyron's eyes glow bright red for a moment.

[93] [97] {2am} Grizzlie 1B1 <24328hp 25000m 24860mv> [80] [2286657] drink rod
You drink blood from a muthafuckin' blood rod.
Your blood thirst is sated.

[93] [97] {2am} Grizzlie 1B1 <24328hp 25000m 24860mv> [100] [2286657] You drink blood from a muthafuckin' blood rod.
Your blood thirst is sated.

[93] [97] {2am} Grizzlie 1B1 <24328hp 25000m 24860mv> [100] [2286657]
Your skin sparks with magical energy.
Your fireball strikes Tyron incredibly hard! (259)
Your claw misses Tyron. (0)
You claw Tyron incredibly hard! (241)
Tyron's fireball strikes you extremely hard! (134)

[88] [96] {2am} Grizzlie 1B1 <24077hp 25000m 24720mv> [98] [2286657]
Tyron's eyes glow bright red for a moment.
Tyron's fireball strikes you extremely hard! (138)

[88] [95] {2am} Grizzlie 1B1 <23939hp 25000m 24720mv> [98] [2286657] drink rod
You drink blood from a muthafuckin' blood rod.
Your blood thirst is sated.

[88] [95] {2am} Grizzlie 1B1 <23939hp 25000m 24720mv> [100] [2286657]
Your skin sparks with magical energy.
Your fireball strikes Tyron extremely hard! (171)
Tyron's fireball strikes you extremely hard! (119)

[85] [93] {2am} Grizzlie 1B1 <23488hp 25000m 24580mv> [91] [2286657] c fire
Your eyes glow bright red for a moment.
Your fireball strikes Tyron extremely hard! (147)

[84] [93] {2am} Grizzlie 1B1 <23488hp 24940m 24580mv> [91] [2286657] drink rod

Tyron's eyes glow bright red for a moment.
Tyron's fireball strikes you extremely hard! (124)

[84] [93] {2am} Grizzlie 1B1 <23364hp 24940m 24580mv> [91] [2286657]
Your fireball strikes Tyron extremely hard! (130)
Tyron's fireball strikes you extremely hard! (115)
Your skin sparks with magical energy.

[81] [91] {2am} Grizzlie 1B1 <22918hp 24940m 24440mv> [88] [2286657] You drink blood from a muthafuckin' blood rod.
Your blood thirst is sated.

[81] [91] {2am} Grizzlie 1B1 <22918hp 24940m 24440mv> [100] [2286657] drink rod
You drink blood from a muthafuckin' blood rod.
Your blood thirst is sated.
Tyron's eyes glow bright red for a moment.

[81] [91] {2am} Grizzlie 1B1 <22918hp 24940m 24440mv> [100] [2286657]
Your fireball strikes Tyron extremely hard! (192)
Tyron's fireball strikes you incredibly hard! (213)

[77] [90] {2am} Grizzlie 1B1 <22512hp 24940m 24300mv> [93] [2286657] c fire
Your eyes glow bright red for a moment.
Your fireball strikes Tyron extremely hard! (147)

[77] [90] {2am} Grizzlie 1B1 <22512hp 24880m 24300mv> [93] [2286657] drink rod

Tyron drinks blood from A Chalice of The Kindred.

[77] [90] {2am} Grizzlie 1B1 <22512hp 24880m 24300mv> [93] [2286657]
Tyron drinks blood from A Chalice of The Kindred.

[77] [90] {2am} Grizzlie 1B1 <22512hp 24880m 24300mv> [93] [2286657]
Tyron's eyes glow bright red for a moment.
Tyron's fireball strikes you extremely hard! (146)

[77] [89] {2am} Grizzlie 1B1 <22366hp 24880m 24300mv> [93] [2286657]
Your fireball strikes Tyron extremely hard! (158)
You claw Tyron incredibly hard! (220)
Tyron's fireball strikes you incredibly hard! (331)

[72] [86] {2am} Grizzlie 1B1 <21586hp 24880m 24150mv> [85] [2286657] c fire
You drink blood from a muthafuckin' blood rod.
Your blood thirst is sated.

[72] [86] {2am} Grizzlie 1B1 <21586hp 24880m 24150mv> [100] [2286657] Your eyes glow bright red for a moment.
Your skin sparks with magical energy.
Your fireball strikes Tyron incredibly hard! (207)

[71] [86] {2am} Grizzlie 1B1 <21586hp 24820m 24150mv> [100] [2286657]
Tyron's eyes glow bright red for a moment.
Tyron's fireball strikes you incredibly hard! (272)

[71] [85] {3am} Grizzlie 1B1 <21314hp 24820m 24150mv> [95] [2286657] drink rod

Your fireball strikes Tyron extremely hard! (131)
You claw Tyron incredibly hard! (219)
You claw Tyron incredibly hard! (254)
Tyron's fireball strikes you extremely hard! (140)

[66] [84] {3am} Grizzlie 1B1 <21022hp 24820m 24010mv> [93] [2286657] You drink blood from a muthafuckin' blood rod.
Your blood thirst is sated.

[66] [84] {3am} Grizzlie 1B1 <21022hp 24820m 24010mv> [100] [2286657] c fire
Your eyes glow bright red for a moment.
Your fireball strikes Tyron extremely hard! (159)
Tyron's eyes glow bright red for a moment.
Tyron's fireball strikes you extremely hard! (105)

[65] [83] {3am} Grizzlie 1B1 <20917hp 24760m 24010mv> [100] [2286657]
Your fireball strikes Tyron extremely hard! (179)
Tyron's fireball strikes you extremely hard! (143)

[62] [81] {3am} Grizzlie 1B1 <20492hp 24760m 23870mv> [99] [2286657] drink rod
You drink blood from a muthafuckin' blood rod.
Your blood thirst is sated.
Tyron drinks blood from A Chalice of The Kindred.
Your skin sparks with magical energy.
Your fireball strikes Tyron incredibly hard! (289)
You claw Tyron incredibly hard! (243)
Tyron's fireball strikes you extremely hard! (139)
Your skin sparks with magical energy.

[57] [80] {3am} Grizzlie 1B1 <20127hp 24760m 23720mv> [98] [2286657]
Tyron drinks blood from A Chalice of The Kindred.

[57] [80] {3am} Grizzlie 1B1 <20127hp 24760m 23720mv> [98] [2286657]
Tyron's eyes glow bright red for a moment.
Tyron's fireball strikes you extremely hard! (128)

[57] [79] {3am} Grizzlie 1B1 <19999hp 24760m 23720mv> [98] [2286657] c fire
Your eyes glow bright red for a moment.
Your fireball strikes Tyron extremely hard! (175)

[56] [79] {3am} Grizzlie 1B1 <19999hp 24700m 23720mv> [98] [2286657] drink rod

Your fireball strikes Tyron extremely hard! (137)
You claw Tyron incredibly hard! (226)
You bite Tyron incredibly hard! (251)
Tyron's fireball strikes you extremely hard! (143)

[49] [78] {3am} Grizzlie 1B1 <19622hp 24700m 23580mv> [90] [2286657]
Tyron's eyes glow bright red for a moment.

[49] [78] {3am} Grizzlie 1B1 <19622hp 24700m 23580mv> [90] [2286657] You drink blood from a muthafuckin' blood rod.
Your blood thirst is sated.

[49] [78] {3am} Grizzlie 1B1 <19622hp 24700m 23580mv> [100] [2286657] c fire

Your fireball strikes Tyron extremely hard! (136)
You claw Tyron incredibly hard! (247)
You claw Tyron incredibly hard! (247)
Tyron's fireball strikes you extremely hard! (165)

[44] [76] {3am} Grizzlie 1B1 <19203hp 24700m 23430mv> [99] [2286657] Your eyes glow bright red for a moment.
Your skin sparks with magical energy.
Your fireball strikes Tyron incredibly hard! (303)

[42] [76] {3am} Grizzlie 1B1 <19203hp 24640m 23430mv> [99] [2286657] drink rod

Tyron drinks blood from A Chalice of The Kindred.

[42] [76] {3am} Grizzlie 1B1 <19203hp 24640m 23430mv> [99] [2286657]
Tyron's eyes glow bright red for a moment.
Tyron's fireball strikes you extremely hard! (157)

[42] [76] {3am} Grizzlie 1B1 <19046hp 24640m 23430mv> [99] [2286657]
Your fireball strikes Tyron extremely hard! (156)
Tyron's fireball strikes you extremely hard! (119)
Tyron claws you extremely hard! (157)

[39] [74] {3am} Grizzlie 1B1 <18608hp 24640m 23280mv> [92] [2286657] You drink blood from a muthafuckin' blood rod.
Your blood thirst is sated.

[39] [74] {3am} Grizzlie 1B1 <18608hp 24640m 23280mv> [100] [2286657] c fire
Your eyes glow bright red for a moment.

[39] [74] {3am} Grizzlie 1B1 <18608hp 24580m 23280mv> [100] [2286657]
Tyron's eyes glow bright red for a moment.
Tyron's fireball strikes you extremely hard! (122)

[39] [73] {3am} Grizzlie 1B1 <18486hp 24580m 23280mv> [100] [2286657] drink rod

Your skin sparks with magical energy.
Your fireball strikes Tyron stupendously hard! (711)
Tyron's fireball strikes you extremely hard! (125)

[34] [73] {3am} Grizzlie 1B1 <18259hp 24580m 23140mv> [96] [2286657] drink rod
You drink blood from a muthafuckin' blood rod.
Your blood thirst is sated.

[34] [73] {3am} Grizzlie 1B1 <18259hp 24580m 23140mv> [100] [2286657] You drink blood from a muthafuckin' blood rod.
Your blood thirst is sated.
Tyron's eyes glow bright red for a moment.
Tyron's fireball strikes you extremely hard! (170)

[34] [72] {3am} Grizzlie 1B1 <18089hp 24580m 23140mv> [100] [2286657] c fire
Your eyes glow bright red for a moment.
Your fireball strikes Tyron extremely hard! (164)

[33] [72] {3am} Grizzlie 1B1 <18089hp 24520m 23140mv> [100] [2286657]
Your skin sparks with magical energy.
Your fireball strikes Tyron incredibly hard! (391)
Your bite misses Tyron. (0)
Tyron's fireball strikes you extremely hard! (115)
Tyron claws you extremely hard! (139)

[28] [70] {3am} Grizzlie 1B1 <17576hp 24520m 23000mv> [96] [2286657]
Tyron's eyes glow bright red for a moment.
Tyron's fireball strikes you extremely hard! (153)

[28] [69] {3am} Grizzlie 1B1 <17423hp 24520m 23000mv> [96] [2286657] drink rod

Your skin sparks with magical energy.
Your fireball strikes Tyron incredibly hard! (282)

[24] [68] {3am} Grizzlie 1B1 <17207hp 24520m 22860mv> [93] [2286657] You drink blood from a muthafuckin' blood rod.
Your blood thirst is sated.

[24] [68] {3am} Grizzlie 1B1 <17207hp 24520m 22860mv> [100] [2286657] c fire
Your eyes glow bright red for a moment.
Your skin sparks with magical energy.
Your fireball strikes Tyron incredibly hard! (340)

[22] [68] {3am} Grizzlie 1B1 <17207hp 24460m 22860mv> [100] [2286657]
Tyron's eyes glow bright red for a moment.
Tyron's fireball strikes you extremely hard! (122)

[22] [68] {4am} Grizzlie 1B1 <17085hp 24460m 22860mv> [95] [2286657]
Your skin sparks with magical energy.
Your fireball strikes Tyron incredibly hard! (288)
Tyron's fireball strikes you extremely hard! (131)
Your skin sparks with magical energy.

[19] [66] {4am} Grizzlie 1B1 <16647hp 24460m 22720mv> [85] [2286657] drink rod
You drink blood from a muthafuckin' blood rod.
Your blood thirst is sated.

[19] [66] {4am} Grizzlie 1B1 <16647hp 24460m 22720mv> [100] [2286657]
Tyron's eyes glow bright red for a moment.

[19] [66] {4am} Grizzlie 1B1 <16647hp 24460m 22720mv> [100] [2286657]
Your fireball strikes Tyron extremely hard! (143)

[16] [65] {4am} Grizzlie 1B1 <16382hp 24460m 22570mv> [98] [2286657] c fire
Your eyes glow bright red for a moment.
Your fireball strikes Tyron extremely hard! (119)

[15] [65] {4am} Grizzlie 1B1 <16382hp 24400m 22570mv> [98] [2286657] drink rod

Tyron's eyes glow bright red for a moment.
Tyron's fireball strikes you extremely hard! (109)

[15] [65] {4am} Grizzlie 1B1 <16273hp 24400m 22570mv> [98] [2286657]
Your fireball strikes Tyron extremely hard! (176)
You claw Tyron incredibly hard! (222)
Tyron's fireball strikes you incredibly hard! (255)

[12] [62] {4am} Grizzlie 1B1 <15692hp 24400m 22430mv> [94] [2286657] You drink blood from a muthafuckin' blood rod.
Your blood thirst is sated.

[12] [62] {4am} Grizzlie 1B1 <15692hp 24400m 22430mv> [100] [2286657] c fire
Your eyes glow bright red for a moment.
Your skin sparks with magical energy.
Your fireball strikes Tyron incredibly hard! (254)

[11] [62] {4am} Grizzlie 1B1 <15692hp 24340m 22430mv> [100] [2286657]
Tyron drinks blood from A Chalice of The Kindred.
You claw Tyron incredibly hard! (279)
Your fireball strikes Tyron extremely hard! (148)
Tyron's fireball strikes you extremely hard! (140)

[6] [61] {4am} Grizzlie 1B1 <15406hp 24340m 22280mv> [95] [2286657]
Tyron drinks blood from A Chalice of The Kindred.

[6] [61] {4am} Grizzlie 1B1 <15406hp 24340m 22280mv> [95] [2286657]
Tyron's eyes glow bright red for a moment.
Tyron's fireball strikes you amazingly hard! (527)

[6] [59] {4am} Grizzlie 1B1 <14879hp 24340m 22280mv> [95] [2286657] drink rod
You drink blood from a muthafuckin' blood rod.
Your blood thirst is sated.

[6] [59] {4am} Grizzlie 1B1 <14879hp 24340m 22280mv> [100] [2286657]
You claw Tyron incredibly hard! (279)
Your fireball strikes Tyron extremely hard! (151)
Tyron's fireball strikes you extremely hard! (167)

[2] [56] {4am} Grizzlie 1B1 <14049hp 24340m 22140mv> [95] [2286657]
Tyron's eyes glow bright red for a moment.
Tyron's fireball strikes you extremely hard! (123)

[2] [55] {4am} Grizzlie 1B1 <13926hp 24340m 22140mv> [95] [2286657] drink rod
You drink blood from a muthafuckin' blood rod.
Your blood thirst is sated.

[2] [55] {4am} Grizzlie 1B1 <13926hp 24340m 22140mv> [100] [2286657]
You claw Tyron incredibly hard! (246)
Your fireball strikes Tyron extremely hard! (155)
Tyron's fireball strikes you extremely hard! (158)
Your skin sparks with magical energy.
Tyron is mortally wounded, and spraying blood everywhere.
Reply with quote
Guthrie
Beginner


Joined: 01 Dec 2011
Posts: 12

PostPosted: Thu Dec 01, 2011 5:36 pm   
 
I'll post what I have together so far. It's really not much but it may be helpful in determining how to help me.


Quote:
#trigger {^You %w %* ~((%d)~)$} {#var dmg %1}

This was made to mostly so I could remember how to store the damage number for any weapon type. lol Problem is I only know how to store one. If I could append numbers to my dmg variable and sort it somehow that would be awesome.

Quote:
#trigger {^Your fireball strikes %* ~((%d)~)$} {#var fireball%1}

Same thing as above except for fireballs.
Reply with quote
Guthrie
Beginner


Joined: 01 Dec 2011
Posts: 12

PostPosted: Thu Dec 01, 2011 8:14 pm   
 
I'm thinking maybe I can use an array to do this. Super noob with arrays though. Going to sit here and crash cmud playing with it until someone replies.
Reply with quote
Guthrie
Beginner


Joined: 01 Dec 2011
Posts: 12

PostPosted: Thu Dec 01, 2011 8:25 pm   
 
Quote:
#trigger {^You %w %* ~((%d)~)$} {#addkey dmg %1}


Uh oh, I think I'm on to something. It automatically sorted it from least to greatest too.

Edit: Won't add duplicate key values.
I tried
Quote:
#trigger {^You %w %* ~((%d)~)$} {#addkey melee %1}

This only saved the last attack. Hrm..

Trying an array again instead of a database I did
Quote:
#trigger {^You %w %* ~((%d)~)$} {#var dmg %array(%1)}

This is only adding the last melee swing to the array. Nothing else. Hrm... -.-

I just did a list too..
Quote:
{^You %w %* ~((%d)~)$} {#var dmg %additem(%1)}

Still only saves the last swing.

Wonder what I'm doing wrong with the arrays, lists and database. I'm sure there is a way to keep appending to a variable with duplicates. Then be able to manipulate the data in the variable to output the way I'd like it to.
This seems to me it would be the easy part to complete on my list. Figuring out how to identify when a round is over and when another begins should be the hardest part.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Thu Dec 01, 2011 9:34 pm   
 
Yes, you want to use stringlists, with the #ADDITEM command or %additem() function. Do not use %array().

Carefully read the documentation for both of these. The format for %additem() is: %additem(newvalue, @stringlist)

Note that #ADDITEM will not add duplicate values; %additem will. #ADDITEM changes the list, %additem simply returns the resulting list without changing it. Since you will want duplicate values, you will want:
Code:

#var dmg %additem(%1, @dmg)

That will get you started...
Reply with quote
Guthrie
Beginner


Joined: 01 Dec 2011
Posts: 12

PostPosted: Thu Dec 01, 2011 10:31 pm   
 
Quote:
#ALIAS k {#unvar fdmg;
#unvar dmg;
#unvar vicfdmg;
#unvar vicdmg;
kill @target
}
#TR {%w's fireball %* ~((%d)~)} {
#var vicfdmg %additem(%1, @vicfdmg)
}
#TR {Tyron %w %* ~((%d)~)} {
#var vicdmg %additem(%1, @vicdmg)
}
#TR {Your fireball strikes %* ~((%d)~)} {
#var fdmg %additem(%1, @fdmg)
}
#TR {You %w %* ~((%d)~)} {
#var dmg %additem(%1, @dmg)
}
#TR {Tyron is mortally wounded} {
#SHOW Your attacks: %sort(@dmg) . ;
#SHOW You fireballs: %sort(@fdmg) .;
#SHOW His attacks: %sort(@vicdmg) .;
#SHOW His fireballs: %sort(@vicfdmg) .

}
#TR {Your attacks: %1|%*|%2 .} {
#SHOW Your average damage per hit: ????????????????????
}



All I can think about now is food. I'm going to come back to this after dinner. I'm thinking about somehow making a trigger to count a round as anytime one of us loses health. If we don't cast spells this can still be viable and accurate to test different gear setups. Once it's finished I mean... Thanks for the tip Rahab! :)
Reply with quote
shalimar
GURU


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

PostPosted: Thu Dec 01, 2011 11:30 pm   
 
This much should tell you who is attacking and what type of attack it is reguardless of line (with what i saw), which should easily allow you to assign the variables you need for combat analysis

#TR {(%w) {incredibly|extremely|stupendously} hard!} {
$fireball=%match(%line, "fireball")
$claw=%match(%line, "claw")
$attacker=%replace(%word(%line, 1), "'s")
$defender=%1
}
_________________
Discord: Shalimarwildcat

Last edited by shalimar on Thu Dec 01, 2011 11:37 pm; edited 1 time in total
Reply with quote
Guthrie
Beginner


Joined: 01 Dec 2011
Posts: 12

PostPosted: Thu Dec 01, 2011 11:37 pm   
 
Here's a tough one. At the end of combat I have all numbers displayed like so:

Quote:
Your attacks: 131|131|132|133|135|135|135|140|141|144|148|152|159|162|166|167|175|209|223|223|223|223|225|225|225|225|227|227|227|227|227|233|241|246|254|254|254|254|255|255|256|256|256|256|256|256|256|256|256|256|256|256|257|257|257|257|258|258|258|377


The number of attacks is not preset. It changes every time. How would I go about averaging the numbers if I don't know how many there are? I'm going to look around and see what I can find.
Reply with quote
Guthrie
Beginner


Joined: 01 Dec 2011
Posts: 12

PostPosted: Thu Dec 01, 2011 11:41 pm   
 
shalimar wrote:
This much should tell you who is attacking and what type of attack it is reguardless of line (with what i saw), which should easily allow you to assign the variables you need for combat analysis

#TR {(%w) {incredibly|extremely|stupendously} hard!} {
$fireball=%match(%line, "fireball")
$claw=%match(%line, "claw")
$attacker=%replace(%word(%line, 1), "'s")
$defender=%1
}



I will try this. Can you tell me what this is called? I'd like to read up on it so what I'm looking at actually makes sense to me. I can probably find information on %match, %replace, %line just by looking in the documentation. What is this though.

It's apparent to me that it allows me to use any dmg indicator in my pattern while making it still easily readable if I had to go back and change anything in the future. Not sure what the rest of it is.


EDIT: So this trigger is fired whenever myself or my victim does incredibly, extremely, or stupedously damage with either a fireball or a claw? Is that basically what this is? I guess if thats the case the only thing throwing me off is $defender=%1. I don't know what to do with that. This could be over my head. I was just reading about delimiters and kinda just went....wtf. I will come back to this to learn more if you choose to not reply to this or simply don't get a chance to check back. I'm just not real sure what to do with it


EDIT: Perhaps you threw me off with the local variables a little bit. I don't mean to make it sound like I just tossed your snippet aside. I'm actually trying to figure it out right now.
EDIT: Okay, I am putting this on the back-burner for now. I do appreciate you bringing it up to me though. Gives me something to learn >=) However, I have this part working already and have a new problem I would like to move forward with. The averaging of a random amount of numbers that probably don't even fit on 1 mud line or the averaging of a random amount of numbers in a string list variable.
Reply with quote
shalimar
GURU


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

PostPosted: Fri Dec 02, 2011 1:19 am   
 
$avg=0
#FORALL @damagecount {$avg=($avg+%i)}
$avg=($avg*1.0/%numitems(@damagecount))
#SAY Over %numitem(@damagecount) hits i did $avg damage.


Sorry to have confused you with the local variables, i didnt know if you needed the defender at all, having it and not using it doesnt really hurt though
_________________
Discord: Shalimarwildcat
Reply with quote
Guthrie
Beginner


Joined: 01 Dec 2011
Posts: 12

PostPosted: Sat Dec 03, 2011 1:59 am   
 
This is what I have working now. Variables are removed with unvar when I initiate combat again.

Quote:
#trigger {You {hit|stab|whip|blast|crush|bite|slice|slash|claw|pound|grep|pierce|suck} %w {very|extremely|incredibly|amazingly|stupendously|unfeasably} hard! ~((%d)~)} {
#var dmg %additem(%1, @dmg)
}
#trigger {Your fireball strikes %w {very lightly|lightly|hard|very hard|extremely hard|incredibly hard|amazingly hard|stupendously hard|unfeasably hard|exceptionally hard|unbelievably hard|extraordinarily hard|impossibly hard|supernaturally hard}! ~((%d)~)} {
#var fdmg %additem(%1, @fdmg)
}
#trigger {%w {hits|stabs|whips|blasts|crushes|bites|slices|slashes|claws|pounds|greps|pierces|sucks} you {very lightly|lightly|hard|very hard|extremely hard|incredibly hard|amazingly hard|stupendously hard|unfeasably hard|exceptionally hard|unbelievably hard|extraordinarily hard|impossibly hard|supernaturally hard}%p ~((%d)~)} {
#var vicdmg %additem(%1, @vicdmg)
}
#trigger {%w's fireball strikes you {very lightly|lightly|hard|very hard|extremely hard|incredibly hard|amazingly hard|stupendously hard|unfeasably hard|exceptionally hard|unbelievably hard|extraordinarily hard|impossibly hard|supernaturally hard}%p ~((%d)~)} {
#var vicfdmg %additem(%1, @vicfdmg)
}
#alias wtf {
$avg=0
#FORALL @dmg {$avg=($avg+%i)}
$avg=($avg*1.0/%numitems(@dmg))
SAY Over %numitems(@dmg) hits I did $avg average damage.
SAY I did anywhere between %min(@dmg) and %max(@dmg) damage.
$avg=0
#FORALL @fdmg {$avg=($avg+%i)}
$avg=($avg*1.0/%numitems(@fdmg))
SAY Over %numitems(@fdmg) fireballs I did $avg average damage.
SAY I did anywhere between %min(@fdmg) and %max(@fdmg)
$avg=0
#FORALL @vicdmg {$avg=($avg+%i)}
$avg=($avg*1.0/%numitems(@vicdmg))
SAY Over %numitems(@vicdmg) hits you did $avg average damage.
SAY You did anywhere between %min(@vicdmg) and %max(@vicdmg) damage.
$avg=0
#FORALL @vicfdmg {$avg=($avg+%i)}
$avg=($avg*1.0/%numitems(@vicfdmg))
SAY Over %numitems(@vicfdmg) fireballs you did $avg average damage.
SAY You did anywhere between %min(@vicfdmg) and %max(@vicfdmg)
}
Reply with quote
Guthrie
Beginner


Joined: 01 Dec 2011
Posts: 12

PostPosted: Sat Dec 03, 2011 2:20 am   
 
Now it writes everything to a file for future reference :)
Quote:

#FILE 1 combat.txt
$avg=0
#FORALL @dmg {$avg=($avg+%i)}
$avg=($avg*1.0/%numitems(@dmg))
SAY Over %numitems(@dmg) hits I did $avg average damage.
SAY I did anywhere between %min(@dmg) and %max(@dmg) damage.
$avg=0
#FORALL @fdmg {$avg=($avg+%i)}
$avg=($avg*1.0/%numitems(@fdmg))
SAY Over %numitems(@fdmg) fireballs I did $avg average damage.
SAY I did anywhere between %min(@fdmg) and %max(@fdmg)
$avg=0
#FORALL @vicdmg {$avg=($avg+%i)}
$avg=($avg*1.0/%numitems(@vicdmg))
SAY Over %numitems(@vicdmg) hits you did $avg average damage.
SAY You did anywhere between %min(@vicdmg) and %max(@vicdmg) damage.
$avg=0
#FORALL @vicfdmg {$avg=($avg+%i)}
$avg=($avg*1.0/%numitems(@vicfdmg))
SAY Over %numitems(@vicfdmg) fireballs you did $avg average damage.
SAY You did anywhere between %min(@vicfdmg) and %max(@vicfdmg)
$avg=0
#FORALL @dmg {$avg=($avg+%i)}
$avg=($avg*1.0/%numitems(@dmg))
#WRI 1 {Over %numitems(@dmg) hits I did $avg average damage.}
#WRI 1 {I did anywhere between %min(@dmg) and %max(@dmg) damage.}
$avg=0
#FORALL @fdmg {$avg=($avg+%i)}
$avg=($avg*1.0/%numitems(@fdmg))
#WRI 1 {Over %numitems(@fdmg) fireballs I did $avg average damage.}
#WRI 1 {I did anywhere between %min(@fdmg) and %max(@fdmg)}
$avg=0
#FORALL @vicdmg {$avg=($avg+%i)}
$avg=($avg*1.0/%numitems(@vicdmg))
#WRI 1 {Over %numitems(@vicdmg) hits you did $avg average damage.}
#WRI 1 {You did anywhere between %min(@vicdmg) and %max(@vicdmg) damage.}
$avg=0
#FORALL @vicfdmg {$avg=($avg+%i)}
$avg=($avg*1.0/%numitems(@vicfdmg))
#WRI 1 {Over %numitems(@vicfdmg) fireballs you did $avg average damage.}
#WRI 1 {You did anywhere between %min(@vicfdmg) and %max(@vicfdmg)}
#WRI 1 { }
#WRI 1 {My swings in the order they were dealt:}
#WRI 1 {@dmg}
#WRI 1 {My attacks sorted:}
#WRI 1 {%sort(@dmg)}
#WRI 1 {My fireballs in the order they were dealt:}
#WRI 1 {@fdmg}
#WRI 1 {My fireballs sorted:}
#WRI 1 {%sort(@fdmg)}
#WRI 1 {Your swings in the order they were dealt:}
#WRI 1 {@vicdmg}
#WRI 1 {Your attacks sorted:}
#WRI 1 {%sort(@vicdmg)}
#WRI 1 {Your fireballs in the order they were dealt:}
#WRI 1 {@vicfdmg}
#WRI 1 {Your fireballs sorted:}
#WRI 1 {%sort(@vicfdmg)}
#WRI 1 { }
#WRI 1 { }
#WRI 1 { }
#CLOSE 1


Last edited by Guthrie on Sat Dec 03, 2011 3:24 am; edited 1 time in total
Reply with quote
Guthrie
Beginner


Joined: 01 Dec 2011
Posts: 12

PostPosted: Sat Dec 03, 2011 2:30 am   
 
It wont append anything thats already in the file. So if I hit that alias twice it will only post the fight once. But will it append it after a different fight? Even though the same exact information is in the file already? I don't plan on having an replica of a fight anytime but I want to be sure ALL of the information I asked it to write is written regardless if its in the file or not.
Reply with quote
Guthrie
Beginner


Joined: 01 Dec 2011
Posts: 12

PostPosted: Sat Dec 03, 2011 5:01 pm   
 
Quote:


#ALIAS who {
#TRIGGER {^(%w)%s(%w)*} {#IF (%2 = @target) {#var status %1}}
~who
#wait 600
#UNTRIGGER {^(%w)%s(%w)*}
}
#TRIGGER {^AC: -(%d). You are ultimately armored!$} {
#var AC -%1
}
#TRIGGER {^Hitroll: (%d). Damroll: (%d). Save: -%d. Blood: %d.$} {
#var HR %1
#var DR %2
}
#TRIGGER {^Hitroll:(%d), Damroll:(%d), AC:-(%d).$} {
#var vHR %1
#var vDR %2
#var vAC -%3
}
#TRIGGER {^%w {hits|stabs|whips|blasts|crushes|bites|slices|slashes|claws|pounds|greps|pierces|sucks} you {very lightly|lightly|hard|very hard|extremely hard|incredibly hard|amazingly hard|stupendously hard|unfeasably hard|exceptionally hard|unbelievably hard|extraordinarily hard|impossibly hard|supernaturally hard}%p ~((%d)~)$} {
#var vicdmg %additem(%1, @vicdmg)
}
#TRIGGER {^%w's fireball strikes you {very lightly|lightly|hard|very hard|extremely hard|incredibly hard|amazingly hard|stupendously hard|unfeasably hard|exceptionally hard|unbelievably hard|extraordinarily hard|impossibly hard|supernaturally hard}%p ~((%d)~)$} {
#var vicfdmg %additem(%1, @vicfdmg)
}
#TRIGGER {^You {hit|stab|whip|blast|crush|bite|slice|slash|claw|pound|grep|pierce|suck} %w {very|extremely|incredibly|amazingly|stupendously|unfeasably} hard! ~((%d)~)$} {
#var dmg %additem(%1, @dmg)
}
#TRIGGER {^Your fireball strikes %w {very lightly|lightly|hard|very hard|extremely hard|incredibly hard|amazingly hard|stupendously hard|unfeasably hard|exceptionally hard|unbelievably hard|extraordinarily hard|impossibly hard|supernaturally hard}! ~((%d)~)$} {
#var fdmg %additem(%1, @fdmg)
}
#ALIAS pvp {
#var target %1
}
#ALIAS tk {
#unvar dmg
#unvar fdmg
#unvar vicfdmg
#unvar vicdmg
#unvar avg1
#unvar avg2
#unvar avg3
#unvar avg4
read @target
score
#wait 800
#Show @target @vAC @vHR / @vDR vs Guthrie @AC @HR / @DR
kill @target
}
#ALIAS wtf {
#FILE 1 master.txt
#FILE 2 average.txt

#WRITE 1 {=============================================}
#WRITE 2 {=============================================}

$avg=0
#FORALL @dmg {$avg=($avg+%i)}
$avg=($avg*1.0/%numitems(@dmg))
#VAR avg1 $avg
SAY Over %numitems(@dmg) hits I did $avg average damage.
SAY I did anywhere between %min(@dmg) and %max(@dmg) damage.

$avg=0
#FORALL @vicdmg {$avg=($avg+%i)}
$avg=($avg*1.0/%numitems(@vicdmg))
#VAR avg2 $avg
SAY Over %numitems(@vicdmg) hits you did $avg average damage.
SAY You did anywhere between %min(@vicdmg) and %max(@vicdmg) damage.

$avg=0
#FORALL @fdmg {$avg=($avg+%i)}
$avg=($avg*1.0/%numitems(@fdmg))
#VAR avg3 $avg
SAY Over %numitems(@fdmg) fireballs I did $avg average damage.
SAY I did anywhere between %min(@fdmg) and %max(@fdmg)

$avg=0
#FORALL @vicfdmg {$avg=($avg+%i)}
$avg=($avg*1.0/%numitems(@vicfdmg))
#VAR avg4 $avg
SAY Over %numitems(@vicfdmg) fireballs you did $avg average damage.
SAY You did anywhere between %min(@vicfdmg) and %max(@vicfdmg)

#WRITE 1 {@target @status @vAC @vHR / @vDR vs Guthrie Legend @AC @HR / @DR}
#WRITE 1 { }
#WRITE 1 {Over %numitems(@dmg) hits I did @avg1 average damage.}
#WRITE 1 {I did anywhere between %min(@dmg) and %max(@dmg) damage.}
#WRITE 1 {Over %numitems(@vicdmg) hits you did @avg2 average damage.}
#WRITE 1 {You did anywhere between %min(@vicdmg) and %max(@vicdmg) damage.}
#WRITE 1 {Over %numitems(@fdmg) fireballs I did @avg3 average damage.}
#WRITE 1 {I did anywhere between %min(@fdmg) and %max(@fdmg)}
#WRITE 1 {Over %numitems(@vicfdmg) fireballs you did @avg4 average damage.}
#WRITE 1 {You did anywhere between %min(@vicfdmg) and %max(@vicfdmg)}
#WRITE 1 { }
#WRITE 1 { }
#WRITE 1 {My swings in the order they were dealt:}
#WRITE 1 {@dmg}
#WRITE 1 {My attacks sorted:}
#WRITE 1 {%sort(@dmg)}
#WRITE 1 {My fireballs in the order they were dealt:}
#WRITE 1 {@fdmg}
#WRITE 1 {My fireballs sorted:}
#WRITE 1 {%sort(@fdmg)}
#WRITE 1 {Your swings in the order they were dealt:}
#WRITE 1 {@vicdmg}
#WRITE 1 {Your attacks sorted:}
#WRITE 1 {%sort(@vicdmg)}
#WRITE 1 {Your fireballs in the order they were dealt:}
#WRITE 1 {@vicfdmg}
#WRITE 1 {Your fireballs sorted:}
#WRITE 1 {%sort(@vicfdmg)}
#WRITE 1 {===============================================================================}
#WRITE 1 { }
#WRITE 1 { }
#WRITE 2 {@target @status @vAC @vHR / @vDR vs Guthrie Legend @AC @HR / @DR}
#WRITE 2 { }
#WRITE 2 {Melee Attacks Count- Me:%numitems(@dmg)|You:%numitems(@vicdmg)}
#WRITE 2 {...Average...}
#WRITE 2 {Me:@avg1|You:@avg2}
#WRITE 2 {....Range....}
#WRITE 2 {Me:%min(@dmg)-%max(@dmg)|You:%min(@vicdmg)-%max(@vicdmg)}
#WRITE 2 {-------------}
#WRITE 2 {Fireballs Count- Me:%numitems(@fdmg)|You:%numitems(@vicfdmg)}
#WRITE 2 {...Average...}
#WRITE 2 {Me:@avg3|You:@avg4}
#WRITE 2 {....Range....}
#WRITE 2 {Me:%min(@fdmg)-%max(@fdmg)|You:%min(@vicfdmg)-%max(@vicfdmg)}
#WRITE 2 {=============================================}
#WRITE 2 { }
#WRITE 2 { }
#CLOSE 1
#CLOSE 2
}


This seems to work okay for now. Thanks everyone for their help. I learned a good deal. :)
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Tue Dec 06, 2011 9:00 pm   
 
For efficiency, you might want to set the variable to {} rather than doing #UNVAR.
Using #UNVAR and later using #VAR uses a lot of extra overhead. But that's a minor point, and some people prefer to use #UNVAR.
Reply with quote
Guthrie
Beginner


Joined: 01 Dec 2011
Posts: 12

PostPosted: Sun Dec 11, 2011 10:52 pm   
 
I like efficiency. Thanks for the tip Rahab :)
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