TinTin++ Mud Client The TinTin++ message board

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
TinTin++ Mud Client

keep track of missing spells/skills from aff

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Finished Scripts
View previous topic :: View next topic  
Author Message
maverick



Joined: 22 Apr 2011
Posts: 13

PostPosted: Sat Apr 23, 2011 3:14 am    Post subject: keep track of missing spells/skills from aff Reply with quote

#ACTION {^The following skills and spells are affecting you:} { #delay {0.5} {showMissingSpells;resetAffects;}}
{5}

#ALIAS {resetAffects} {
#var affDetectMagic -1;
#var affArmor -1;
#var affDetectInvis -1;
#var affMassInvis -1;
#var affProtectiveShield -1;
#var affWraithform -1;
#var affDarkshield -1;
#var affGhoulFlesh -1;
#var affLichsPalm -1;
#var affSenseLiving -1;
#var affImprovedShield -1;
#var affFlying -1;} {5}

#ALIAS {showMissingSpells} {
#if {$affDetectMagic == -1} {#delay {0.2} {#showme Lacking: Detect Magic}};
#if {$affArmor == -1} {#delay {0.2} {#showme Lacking: Armor}};
#if {$affDetectInvis == -1} {#delay {0.2} {#showme Lacking: Detect Invis}};
#if {$affMassInvis == -1} {#delay {0.2} {#showme Lacking: Mass Invis}};
#if {$affProtectiveShield == -1} {#delay {0.2} {#showme Lacking: Protective Shield}};
#if {$affWraithform == -1} {#delay {0.2} {#showme Lacking: Wraithform}};
#if {$affDarkshield == -1} {#delay {0.2} {#showme Lacking: Darkshield}};
#if {$affGhoulFlesh == -1} {#delay {0.2} {#showme Lacking: Ghoul Flesh}};
#if {$affLichsPalm == -1} {#delay {0.2} {#showme Lacking: Lichs Palm}};
#if {$affSenseLiving == -1} {#delay {0.2} {#showme Lacking: Sense Living}};
#if {$affImprovedShield == -1} {#delay {0.2} {#showme Lacking: Improved Shield}};
#if {$affFlying == -1} {#delay {0.2} {#showme Lacking: Flying}};} {3}

#ACTION {'Detect magic' %0 is active for %1 hours and %2 minutes} {#var affDetectMagic %2} {1}
#ACTION {'Armor' %0 is active for %1 hours and %2 minutes} {#var affArmor %2} {1}
#ACTION {'Detect invis' %0 is active for %1 hours and %2 minutes} {#var affDetectInvis %2} {1}
#ACTION {'Mass invis' %0 is active for %1 hours and %2 minutes} {#var affMassInvis %2} {1}
#ACTION {'Protective shield' %0 is active for %1 hours and %2 minutes} {#var affProtectiveShield %2} {1}
#ACTION {'Wraithform' %0 is active for %1 hours and %2 minutes} {#var affWraithform %2} {1}
#ACTION {'Darkshield' %0 is active for %1 hours and %2 minutes} {#var affDarkshield %2} {1}
#ACTION {'Ghoul flesh' %0 is active for %1 hours and %2 minutes} {#var affGhoulFlesh %2} {1}
#ACTION {'Lichs palm' %0 is active for %1 hours and %2 minutes} {#var affLichsPalm %2} {1}
#ACTION {'Sense living' %0 is active for %1 hours and %2 minutes} {#var affSenseLiving %2} {1}
#ACTION {'Improved shield' %0 is active for %1 hours and %2 minutes} {#var affImprovedShield %2} {1}
#ACTION {'Flying' %0 is active %1} {#var affFlying %1} {1}

#HIGHLIGHT {Lacking:} {bold} {5}
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Sat Apr 23, 2011 1:32 pm    Post subject: Reply with quote

I'd suggest nesting the variables which allows streamlining the code. Haven't tested this code, but it might work out of the box:

Code:

#ACTION {^The following skills and spells are affecting you:}
{
  #delay {0.5} {showMissingSpells;resetAffects;}

{5}

#ALIAS {resetAffects}
{
  #var {aff}
  {
    {Detect magic} {-1}
    {Armor} {-1}
    {Detect invis} {-1}
    {Mass invis} {-1}
    {Protective shield} {-1}
    {Wraithform} {-1}
    {Darkshield} {-1}
    {Ghoul flesh} {-1}
    {Lichs palm} {-1}
    {Sense living} {-1}
    {Improved shield} {-1}
    {Flying} {-1}
  } 
}
{5}
   
resetAffects

#ALIAS {showMissingSpells}
{
  #foreach {$aff[]} {tmp}
  {
    #if {$aff[$tmp] == -1}
    {
      #line {substitute} {variables}
      {
        #delay {0.2} {#showme Lacking: $tmp}
      }
    } 
  } 
}
 
#foreach {$aff[]} {tmp}
{
  #line {substitute} {variables}
  {
    #action {'$tmp' %1 is active for %2 hours and %3 minutes}
    {
      #math aff[$tmp] %2 * 60 + %3
    }
  } 
}
 
#HIGHLIGHT {Lacking:} {bold} {5}
Back to top
View user's profile Send private message Send e-mail
maverick



Joined: 22 Apr 2011
Posts: 13

PostPosted: Mon Apr 25, 2011 3:12 pm    Post subject: Reply with quote

tnx, will check how it works.
Back to top
View user's profile Send private message
JeramyMT



Joined: 07 Nov 2011
Posts: 9

PostPosted: Wed Nov 09, 2011 7:17 am    Post subject: Reply with quote

Hopefully this is coherent. It's my first post and I'm about 5 hours past my bedtime:) I was able to use the above script quite effectively for the mud I play but ran into an issue. There are some affects that have similar names (ie. weed shield, and shield} so when the foreach cycles through it sees shield but doesn't differentiate between that and weed shield so weed shield is left out when Lacking: <spell affects> are shown. Is there an easy modification to include this?

My #Foreach looks as follows:
Code:

#foreach {$aff[]} {tmp}
{
  #line {substitute} {variables}
  {
    #action {$tmp modifies %1 by %2 for %3 hours}
    {
      #math aff[$tmp] %3
    }
  }
}


My next question is what would I need to change to be able to show "Lacking: <spell name> affects %1 by %2" as in the above #Foreach example(%1 being ac, and %2 being -40)? I'm guessing I'd have to use a list instead?[/code]
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Wed Nov 09, 2011 9:18 am    Post subject: Reply with quote

You could try: #action {^$tmp modifies %1 by %2 for %3 hours} to make sure the beginning of the action is matched.

To show more info about the affects you'd have to store them somehow. For example:

Code:

#var {affdata}
{
    {Detect Magic} {{type}{none}{mod}{0}}
    {Armor} {{type}{ac}{mod}{-40}}
}

#showme {Lacking: Detect Magic affects $affdata[Detect Magic][type] by $affdata[Detect Magic][mod].}
Back to top
View user's profile Send private message Send e-mail
JeramyMT



Joined: 07 Nov 2011
Posts: 9

PostPosted: Wed Nov 09, 2011 3:55 pm    Post subject: Reply with quote

The output of the Affect command looks like the following so the #action {^$tmp modifies %1 by %2 for %3 hours} probably won't work:

(*note - the spacing between 'Spell:' and '<spellname> modifies' varies and since the forum seems to strip spacing I had to insert an image to show how it actually looks)


Any ideas? Also, I really appreciate the help! I'll try your suggestion for storing the data and see what happens.

An aside note on this script - I'm seeing "#MATH EXP: UNKNOWN OPERATOR: =" error when I type affect, but only on WinTin and not on the Os X platform.

#DEBUG ALIAS {showMissingSpells} {}
[08] foreach {tmp}
[10] if {$aff[$tmp] == -1}
[05] endif
[05] endforeach
[08] foreach {tmp}
[10] if {$aff[$tmp] == -1}

#MATH EXP: UNKNOWN OPERATOR: =
[05] endif
[05] endforeach
[08] foreach {tmp}
[10] if {$aff[$tmp] == -1}
[05] endif
[05] endforeach
[08] foreach {tmp}
[10] if {$aff[$tmp] == -1}
[05] endif
[05] endforeach


Also, what's the easiest way to make a donation to you?
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Wed Nov 09, 2011 7:35 pm    Post subject: Reply with quote

In that case you'd want to try matching for a variable amount of spaces:
Code:

#action {Spell:{\s*} $tmp modifies %1 by %2 for %3 hours}


The math error is most likely generated by an affect not being set to a numeric value. Use #var aff to check the variable whenever the error shows up.


Donation wise, easiest is probably to use the sourceforge link, which uses paypal:

http://sourceforge.net/donate/index.php?group_id=137339
Back to top
View user's profile Send private message Send e-mail
maverick



Joined: 22 Apr 2011
Posts: 13

PostPosted: Wed Sep 17, 2014 9:06 am    Post subject: Reply with quote

Now, I've took what you wrote, but it doesn't work for me.

Code:

#ACTION {^The following skills and spells are affecting you:}
{
  #delay {0.5} {showMissingSpells;resetAffects;}
}
{5}

#ALIAS {resetAffects}
{
  #var {aff}
  {
        {Armor}{-1}
        {Bless}{-1}
        {Detect evil}{-1}
        {Protection}{-1}
        {Detect invis}{-1}
        {Frenzy}{-1}
        {Lightshield}{-1}
        {Protectorate}{-1}
        {Holy prayer}{-1}
        {Divine health}{-1}
        {Shield of faith}{-1}
        {Templars sight}{-1}
        {Divine health}{-1}
        {Aura of courage}{-1}
        {Spiritual healing}{-1}
  }
}
{5}

#ALIAS {showMissingSpells}
{
  #foreach {$aff[]} {tmp}
  {
    #if {$aff[$tmp] == -1}
    {
      #line {substitute} {variables}
      {
        #delay {0.2} {#showme Lacking: $tmp}
      }
    }
  }
}

#foreach {$aff[]} {tmp}
{
  #line {substitute} {variables}
  {
    #action {'$tmp' %1 is active for %2 hours and %3 minutes}
    {
      #math aff[$tmp] %2 * 60 + %3
    }
  }
}

#HIGHLIGHT {Lacking:} {bold} {5}


here is what happes

Code:


#DEBUG ACTION {^The following skills and spells are affecting you:}
[02] delay {0.5} {showMissingSpells;resetAffects;}
The following skills and spells are affecting you:

'Detect evil' spell is active for 1 hours and 0 minutes
'Divine health' skill is active for 1 hours and 30 minutes
'Holy prayer' spell is active for 2 hours and 0 minutes
'Protectorate' spell is active for 2 hours and 35 minutes
'Frenzy' spell is active for 5 hours and 35 minutes
'Lightshield' spell is active for 7 hours and 30 minutes
'Detect invis' spell is active for 23 hours and 40 minutes
'Bless' spell is active for 24 hours and 0 minutes
'Warrior spirit' skill is active permanently

<985/985hp 515/515mana 292/292mv 757470tnl | S>
#DEBUG ALIAS {showMissingSpells} {}
[08] foreach {tmp}
[10]     if {$aff[$tmp] == -1}
[02]         line {substitute} {variables}{#delay {0.2} {#showme Lacking: $tmp}}
[02] delay {0.2} {#showme Lacking: Armor}
[05]     endif
[05] endforeach
[08] foreach {tmp}
[10]     if {$aff[$tmp] == -1}
[02]         line {substitute} {variables}{#delay {0.2} {#showme Lacking: $tmp}}
[02] delay {0.2} {#showme Lacking: Aura of courage}
[05]     endif
[05] endforeach
[08] foreach {tmp}
[10]     if {$aff[$tmp] == -1}
[02]         line {substitute} {variables}{#delay {0.2} {#showme Lacking: $tmp}}
[02] delay {0.2} {#showme Lacking: Bless}
[05]     endif
[05] endforeach
[08] foreach {tmp}
[10]     if {$aff[$tmp] == -1}
[02]         line {substitute} {variables}{#delay {0.2} {#showme Lacking: $tmp}}
[02] delay {0.2} {#showme Lacking: Detect evil}
[05]     endif
[05] endforeach
[08] foreach {tmp}
[10]     if {$aff[$tmp] == -1}
[02]         line {substitute} {variables}{#delay {0.2} {#showme Lacking: $tmp}}
[02] delay {0.2} {#showme Lacking: Detect invis}
[05]     endif
[05] endforeach
[08] foreach {tmp}
[10]     if {$aff[$tmp] == -1}
[02]         line {substitute} {variables}{#delay {0.2} {#showme Lacking: $tmp}}
[02] delay {0.2} {#showme Lacking: Divine health}
[05]     endif
[05] endforeach
[08] foreach {tmp}
[10]     if {$aff[$tmp] == -1}
[02]         line {substitute} {variables}{#delay {0.2} {#showme Lacking: $tmp}}
[02] delay {0.2} {#showme Lacking: Frenzy}
[05]     endif
[05] endforeach
[08] foreach {tmp}
[10]     if {$aff[$tmp] == -1}
[02]         line {substitute} {variables}{#delay {0.2} {#showme Lacking: $tmp}}
[02] delay {0.2} {#showme Lacking: Holy prayer}
[05]     endif
[05] endforeach
[08] foreach {tmp}
[10]     if {$aff[$tmp] == -1}
[02]         line {substitute} {variables}{#delay {0.2} {#showme Lacking: $tmp}}
[02] delay {0.2} {#showme Lacking: Lightshield}
[05]     endif
[05] endforeach
[08] foreach {tmp}
[10]     if {$aff[$tmp] == -1}
[02]         line {substitute} {variables}{#delay {0.2} {#showme Lacking: $tmp}}
[02] delay {0.2} {#showme Lacking: Protection}
[05]     endif
[05] endforeach
[08] foreach {tmp}
[10]     if {$aff[$tmp] == -1}
[02]         line {substitute} {variables}{#delay {0.2} {#showme Lacking: $tmp}}
[02] delay {0.2} {#showme Lacking: Protectorate}
[05]     endif
[05] endforeach
[08] foreach {tmp}
[10]     if {$aff[$tmp] == -1}
[02]         line {substitute} {variables}{#delay {0.2} {#showme Lacking: $tmp}}
[02] delay {0.2} {#showme Lacking: Shield of faith}
[05]     endif
[05] endforeach
[08] foreach {tmp}
[10]     if {$aff[$tmp] == -1}
[02]         line {substitute} {variables}{#delay {0.2} {#showme Lacking: $tmp}}
[02] delay {0.2} {#showme Lacking: Spiritual healing}
[05]     endif
[05] endforeach
[08] foreach {tmp}
[10]     if {$aff[$tmp] == -1}
[02]         line {substitute} {variables}{#delay {0.2} {#showme Lacking: $tmp}}
[02] delay {0.2} {#showme Lacking: Templars sight}
[05]     endif
[05] endforeach
#DEBUG ALIAS {resetAffects} {}
[02] variable {aff}{{Armor}{-1}{Bless}{-1}{Detect evil}{-1}{Protection}{-1}{Detect
invis}{-1}{Frenzy}{-1}{Lightshield}{-1}{Protectorate}{-1}{Holy prayer}{-1}{Divine
health}{-1}{Shield of faith}{-1}{Templars sight}{-1}{Divine health}{-1}{Aura of
courage}{-1}{Spiritual healing}{-1}}
Lacking: Armor
Lacking: Aura of courage
Lacking: Bless
Lacking: Detect evil
Lacking: Detect invis
Lacking: Divine health
Lacking: Frenzy
Lacking: Holy prayer
Lacking: Lightshield
Lacking: Protection
Lacking: Protectorate
Lacking: Shield of faith
Lacking: Spiritual healing
Lacking: Templars sight


It's listing everything from the list, like it never made the match/check.
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Wed Sep 17, 2014 4:42 pm    Post subject: Reply with quote

Did you add the action? I don't see one triggering.
Back to top
View user's profile Send private message Send e-mail
maverick



Joined: 22 Apr 2011
Posts: 13

PostPosted: Thu Sep 18, 2014 2:45 am    Post subject: Reply with quote

Scandum wrote:
Did you add the action? I don't see one triggering.


Sorry, which one, I am just testing code you wrote in response to my. Smile
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Thu Sep 18, 2014 7:16 am    Post subject: Reply with quote

It's lacking an action to capture the spells.
Back to top
View user's profile Send private message Send e-mail
maverick



Joined: 22 Apr 2011
Posts: 13

PostPosted: Thu Sep 18, 2014 11:28 am    Post subject: Reply with quote

Scandum wrote:
It's lacking an action to capture the spells.


Code:

#ACTION {'Detect magic' %0 is active for %1 hours and %2 minutes} {#var affDetectMagic %2} {1}
#ACTION {'Armor' %0 is active for %1 hours and %2 minutes} {#var affArmor %2} {1}
#ACTION {'Detect invis' %0 is active for %1 hours and %2 minutes} {#var affDetectInvis %2} {1}
#ACTION {'Mass invis' %0 is active for %1 hours and %2 minutes} {#var affMassInvis %2} {1}
#ACTION {'Protective shield' %0 is active for %1 hours and %2 minutes} {#var affProtectiveShield %2} {1}
#ACTION {'Wraithform' %0 is active for %1 hours and %2 minutes} {#var affWraithform %2} {1}
#ACTION {'Darkshield' %0 is active for %1 hours and %2 minutes} {#var affDarkshield %2} {1}
#ACTION {'Ghoul flesh' %0 is active for %1 hours and %2 minutes} {#var affGhoulFlesh %2} {1}
#ACTION {'Lichs palm' %0 is active for %1 hours and %2 minutes} {#var affLichsPalm %2} {1}
#ACTION {'Sense living' %0 is active for %1 hours and %2 minutes} {#var affSenseLiving %2} {1}
#ACTION {'Improved shield' %0 is active for %1 hours and %2 minutes} {#var affImprovedShield %2} {1}
#ACTION {'Flying' %0 is active %1} {#var affFlying %1} {1}


this?
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Thu Sep 18, 2014 2:31 pm    Post subject: Reply with quote

Need to change that to use a table.

#var aff[Detect evil] %2

etc
Back to top
View user's profile Send private message Send e-mail
maverick



Joined: 22 Apr 2011
Posts: 13

PostPosted: Sat Sep 20, 2014 12:52 am    Post subject: Reply with quote

Scandum wrote:
Need to change that to use a table.

#var aff[Detect evil] %2

etc


Works, thanks!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Finished Scripts All times are GMT - 5 Hours
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
Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads
TinTin++ Homepage

Powered by phpBB © 2001, 2002 phpBB Group