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

#if help

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



Joined: 11 Jan 2008
Posts: 47

PostPosted: Thu Jan 31, 2008 10:19 am    Post subject: #if help Reply with quote

I'm Sorry, the title was rather elusive. Here's my problem:
In the game I play they use what are called "Styles", here is the display for which styles are at what:

--------------------------------[ CORE SKILLS ]--------------------------------
Combat : 88 Athletics: 80 Riding : 0 Meditate : 0 Lore : 0
----------------------------------[ WEAPONS ]----------------------------------
Unarmed : 35 Swords : 72 Daggers : 25 Axes : 25 Clubs : 25
Shields : 25 Flails : 25 Polearms : 25 Bows : 25 Improv. : 25
-----------------------------------[ MAGIC ]-----------------------------------
Purple : 0 Red : 0 Blue : 0 Green : 0 Yellow : 0
---------------------------[ BASIC FIGHTING STYLES ]---------------------------
Viper : 54 Crane : 83 Crab : 50 Mongoose : 50 Bull : 62
-------------------------[ ADVANCED FIGHTING STYLES ]--------------------------
Mantis : 0 Dragon : 0 Tiger : 0 Monkey : 0 Swallow : 0
Bear : 0 Cobra : 0 Eagle : 0 Scorpion : 0 Fox : 0
---------------------------[ SUPER FIGHTING STYLES ]---------------------------
Hawk : 0 Rhino : 0 Lion : 0 Ape : 0 Asp : 0
Serpent : 0 Hydra : 0 Leopard : 0 Wolf : 0 Flea : 0
-------------------------------------------------------------------------------


Now you'll notice that each style is at a specific number, here's what i want to do, I need to write a script that checks to see if a style is at 100, but here's the catch, If the style isn't at 100 it should switch to a different style that is not at 100. Now I want all of the 'basic' styles to be at 100 before it triest to use the 'advanced' styles, and all of the 'advanced' styles to be at 100 before it switches to 'super' styles. How can I write a script that checks if a style is at 100, and if it is, switch to one that isn't, unless they're all at 100 in which case move to the next level of styles?
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Thu Jan 31, 2008 11:10 am    Post subject: Reply with quote

First you store the style percentages in a list:

Code:

#act {Viper : %0 Crane : %1 Crab : %2 Mongoose : %3 Bull : %4}
{
    #var styles[1] %0;
    #var styles[2] %1;
    #var styles[3] %2;
    #var styles[4] %3;
    #var styles[5] %4
}

#act {Mantis : %0 Dragon : %1 Tiger : %2 Monkey : %3 Swallow : %4}
{
    #var styles[6] %0;
    #var styles[7] %1;
    #var styles[8] %2;
    #var styles[9] %3;
    #var styles[10] %4
}


You'd need 3 more actions for the other styles, but that's more of the same. Next you need a 2nd list with style names:

Code:

#var stylenames {Viper Crane Crab Mongoose Bull Mantis Dragon Tiger Monkey Swallow etc}


Check every 60 seconds if an update is needed:

Code:

#tick {updatestyles}
{
    (command to see styles);
    #var temp 1
    #loop {1 25}
    {
        #if {$temp && styles[&0] < 100}
        {
            style $stylenames[&0];
            #var temp 0
        }
    }
}
{60}
Back to top
View user's profile Send private message Send e-mail
svakanda



Joined: 25 Jan 2008
Posts: 18
Location: Missoula, MT

PostPosted: Thu Jan 31, 2008 11:36 am    Post subject: hey tyler Reply with quote

First you need the script to read in the values of the styles....
for that we'll use the #action command which triggers certain commands in reply to the mud outputting a particular string.

Code:

#action {Viper : %1 Crane : %2 Crab : %3 Mongoose : %4 Bull : %5} {
       #list basic clr;
       #var Viper %1;
       #if {%1 < 100} {#list basic ins 1 viper};
       #var Crane %2;
       #if {%2 < 100} {#list basic ins 1 crane};
       #var Crab %3;
       #if {%3 < 100} {#list basic ins 1 crab};
       #var Mongoose %4;
       #if {%4 < 100} {#list basic ins 1 mongoose};
       #var Bull %5;
       #if {%5 < 100} {#list basic ins 1 bull};
}


Now whenever the 'level' command or whatever shows your stances comes up on the screen, it automatically fires off that section of script which reads the value of those stances into variables, and then adds the name of the stance to the list titled basic if it was below 100.

We have an alias and a ticker below to form a basic botstanceswitcher...if you want to integrate the rest of the stances look up #if statements and #lists...referto #help if and #help list inside tt++ for good documentation of how to use these.

so now if you have a training bot and you want him to automatically shuffle through basic stances that are not yet at 100...you can do something like this.

Code:

#alias {next} {#list basic get 1 targetStance;stance $targetStance}
#ticker {stanceShuffleTimer} {level;next} {120}


So what we did there is we made a command called 'next' that retrieves the first stance in the basic list, and sets the variable 'targetStance' to hold that value.

then we made a ticker(that repeats a given command every 'so many' seconds). The ticker repeats two commands every 120 seconds...first it types 'level'...to update it's information on the stances...and finally it uses our new command 'next', which will switch your stance to the first stance on the list.

note* that if a stance is at or above 100 it shouldn't be added to the list, and thus will be 'ignored'.

note** we didn't use the variables with the style amounts saved in them...but you may want to use those if you are going try and automate all three levels of stances, instead of just the first one.

I hope that helps, the code should all be good, but I haven't tested it. Let me know if you run into any issues =)
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
svakanda



Joined: 25 Jan 2008
Posts: 18
Location: Missoula, MT

PostPosted: Thu Jan 31, 2008 11:38 am    Post subject: lol! Reply with quote

your too fast Scandum! nice solution too Coffee very elegant. I didn't know you could use lists like arrays..thats so cool.
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Thu Jan 31, 2008 1:19 pm    Post subject: Reply with quote

Totally Sweet
Back to top
View user's profile Send private message Send e-mail
Tyler



Joined: 11 Jan 2008
Posts: 47

PostPosted: Thu Jan 31, 2008 8:33 pm    Post subject: Reply with quote

goodness, you people are amazing (looks at scandum) i never would have guessed at anything even similar to that, i had almost given up hope that it was even possible Thank You all Very Much, and thank you svakanda, I'd have never thought of that either 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