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

How to manage flags on commands that doesn't give response ?

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> General Discussion
View previous topic :: View next topic  
Author Message
PowerGod



Joined: 04 Aug 2014
Posts: 339

PostPosted: Mon Aug 04, 2014 9:09 am    Post subject: How to manage flags on commands that doesn't give response ? Reply with quote

I have made some automation for casting again spells at every failed attempts, until them are active, or effectively launched.

I use flags to know their state, so when something is casted the related flag become ON and remains ON until the right string is received from the MUD.

It works for almost every cast, except for this situation (simplified):

it is an area cast, so it doesn't need a target enemy, this is when it works
Code:

cast 'superpowerword'
FAILSUPERPOWERWORD = ON

You failed to cast 'superpowerword'
auto-cast 'superpowerword'

You disrupt the poor prince.
FAILSUPERPOWERWORD = OFF
You disrupt the bear.
You heavily hit the bug.
FAILSUPERPOWERWORD = OFF


BUT when no enemies are there this is what happens
Code:

cast 'superpowerword'
FAILSUPERPOWERWORD = ON

You failed to cast 'superpowerword'
auto-cast 'superpowerword'


I just don't know how to turn OFF that flag...

My solution for now is resetting the flag at every prompt, but sometime it works, sometimes it brakes the chain of auto-cast...

Does anyone have a smart idea on how to deal with this situation ?

(actually I don't use flags but I have a list with all the launched casts, deleting all the elements after them are casted correcty, I just simplified it here)
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Mon Aug 04, 2014 12:20 pm    Post subject: Reply with quote

Can use 0 for off and 1 for on instead, increment the value for each fail, reset to 1 on success, and stop if there are 3 fails in a row.
Back to top
View user's profile Send private message Send e-mail
PowerGod



Joined: 04 Aug 2014
Posts: 339

PostPosted: Mon Aug 04, 2014 5:53 pm    Post subject: Reply with quote

but the auto-cast is triggered by that string "You failed to cast 'superpowerword'", so If the cast is successful I don't have other trials, and I don't know that it was casted...

well... maybe it's better to explain the real situation to make it more understandable...

I have different spells that have the SAME message when them fail, so if I launch some of them together (cast 'spell 1';cast 'spell 2';cast 'spell 5') the ACTION must know somehow in what order and what were casted to launch again that command.

So I have a LIST where I add the names of everything casted, and when the ACTION is triggered by a failure, it takes the first var on the list, deletes it and then cast it again, re-adding the string at the end of the list.

Those strings are removed from the list only by the respective ACTIONs of successful cast or hit, that every spell have, except for one, that returns nothing if it is succefully casted without opponents...

The problem is that the string of that spell remains in the list, and after this if another spell is launched and fails, the "not recognized one" is casted instead of the real one... and if it is succefully casted again without being recognized, I'll have 2 vars with the same spell in the list, etc...

So I added the deletion of all the vars of that spell from the list in the ACTION that I use to take values from the prompt.
But it is somehow random when the recognition is stopped... for example if that spell is the third in a chain of other spells, the prompt will be recognized for the other ones before the third, and so the string will be deleted actually before the cast itself... and in case of failure, the ACTION for that will not know that the spell was casted...

OT: Scandum, seems you are the MAN here, the BOSS that makes all this thing going on, so maybe you can be happy to know that I succefully compiled tt++ for the OpenPandora and I'm testing it before the release. Smile
Back to top
View user's profile Send private message
PowerGod



Joined: 04 Aug 2014
Posts: 339

PostPosted: Mon Aug 04, 2014 9:12 pm    Post subject: Reply with quote

Seems like I found a solution... it's so simple that I just can't believe it's really working, but every test was successful for now Smile

When the prompt is recognized, that spell is deleted from the list only if it is the FIRST item ! Smile

Seems like if it is recognized as successful or failing, the related ACTIONs are doing their work and deletes the item before the prompt, and if there is no return status it is immediately deleted!

Cool ! Smile
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 -> General Discussion 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