Help - Search - Members - Calendar
Full Version: Def Up Script.
Achaea's Forums > Off-Topic > Tech Support > Client Help
Vlad
I'm starting to make a defence script in cmud and I'm wondering if there is any tutorials up for making a simple defup script? One where they don't use timers.
Dusty
Why not without timers? That's pretty much the easier(though inflexible) way to do it. Without timers you're going to have to do a whole balance tracking script and then create a TODO queue that works off the balance script. This is the first thing I scripted into my system, and it took A LOT of tweaking and bug fixing before it became usable... and even then I'm not sure if it's combat-ready.
Vlad
I could be wrong but timers isn't the best thing to use due to the fact that balance could come at any time due to lag and timers could miss it and not work or hit it but not at the optimal time. The balance thing is exactly what I want/need and that I can do but not sure how best to do it. How do you put it in a queue without having a ton of if statements? You said TODO queue. Is there any tutorials on that? I see a #ADDITEM thing so I might have a look at that and see if I can do something with that.

Nitro
QUOTE (Vlad @ Sep 16 2009, 07:40 AM) *
I could be wrong but timers isn't the best thing to use due to the fact that balance could come at any time due to lag and timers could miss it and not work or hit it but not at the optimal time. The balance thing is exactly what I want/need and that I can do but not sure how best to do it. How do you put it in a queue without having a ton of if statements? You said TODO queue. Is there any tutorials on that? I see a #ADDITEM thing so I might have a look at that and see if I can do something with that.


I made several systems based on this todo stuff, it is how most curing systems work aswell.

Make a database which contains defences which need no equilibrium/balance to put up, and make a database which contains the one which DO need balance/equlibrium. These databases will also contain the command which needs to be executed to get the defence:

bal_equi_defs

cloak - touch cloak
mindseye - touch mindseye
deathsight - deathsight

free_defs

insomnia - insomnia
... - ...

Make an empty variable defqueue

Next is to make a triggers for the def up line for each defence, and make that trigger do #delitem defqueue -defence-

Next make a prompt trigger, which looks up the defqueue variable, and executes the defs which are stored in it, the free ones whenever, and the bal/equi ones whenever you have bal/equi.

Then you use #additem defqueue -defence- to add a certain defence to the queue.

Next you can add several checks/ifs to avoid spamming when you receive lots of prompts, but that's secondary.
Jonathin
Timers are great for resetting things if something goes wrong, forcing it to move on. Just do what Nitro said, and you could have timers that activate for each specific balance.

For example, on my Aetolian autosipper I wrote I have two timers, one that activates when I sip health or mana, and one when I eat moss. If the message "You can drink another healing elixir." (or whatever it is) doesn't come for some reason (like I didn't sip, or it was an illusion(which has it's own whole setup but I'm not getting into that)), it'll reset the variables, allowing it to autosip again.

After the timer is activated, it just turns off once it receives the "You can drink another elixir" thing.

^I have the exact same thing for moss.
Dusty
Wow, it's been a while since I've screwed around with exported scripts. Here's my action queue I have scripted, though like I already posted, it's far from perfect but it should give you an idea. Also included random bits and pieces that make use of it.
CODE
#CLASS {DustySystem}
#ALIAS offbalance {#VAR balances.%1 1}
#ALIAS onbalance {#VAR balances.%1 0;doaction}
#ALIAS notice {#SAY {%ansi(yellow)|%ansi(green)[ %ansi(white)%-1 %ansi(green)]%ansi(yellow)|}}
#ALIAS waitbalance {#VAR balances.%1 .5}
#REGEX {^(\d+)h, (\d+)m ([cexkdb]+)} {#VAR stats.health %1;#VAR stats.mana %2;#IF (%pos(e,%3)>0) {#VAR balances.EQ 0} {#VAR balances.EQ 1};#IF (%pos(x,%3)>0) {#VAR balances.BAL 0} {#VAR balances.BAL 1}} "" {prompt}
#TRIGGER {^You have recovered balance on all limbs.} {onbalance BAL;doaction}
#TRIGGER {^You have recovered equilibrium.} {onbalance EQ;doaction}
#TRIGGER {^{You have recovered balance on all limbs.|You have recovered equilibrium.}} {#CW white,blue;doaction}
#REGEX {^You are level (\d+) \([A-Za-z0-9 ]+\) and (\d+)\% of the way to the next level\.} {#GAG;#IF (%2 > @stats.percent) {notice percent up by: %ansi(green)%eval(%2 - @stats.percent)};#IF (%2 < @stats.percent) {notice percent down by: %ansi(red)%abs(%eval(%2 - @stats.percent))};#VAR stats.level %1;#VAR stats.percent %2}
#REGEX {^Health:\s*(\d+) /\s*(\d+)\s*Mana:\s*(\d+) /\s*(\d+)\n^Endurance:\s*(\d+) /\s*(\d+)\s*Willpower:\s*(\d+) /\s*(\d+)} {#VAR stats.health %1;#VAR stats.maxhealth %2;#VAR stats.mana %3;#VAR stats.maxmana %4}
#TRIGGER {You must regain equilibrium first.} {offbalance EQ}
#CLASS 0
#CLASS {DustySystem|ActionQueue}
#ALIAS dofree {#VAR dofree %addItem({%-1},@dofree);doaction}
#ALIAS do {#VAR do %addItem({%-1},@do);doaction}
#ALIAS doaction {#IF (!@balances.BAL & !@balances.EQ) {#IF (!@balances.ACT) {#IF (%numitems(@dofree)>0) {#FORALL @dofree {%exec(%pop(dofree))}};#IF (%numitems(@do)>0) {%exec(%pop(do));#VAR balances.ACT 1;#ALARM "actionwait" +.5 {#VAR balances.ACT 0}}}}}
#CLASS 0
#CLASS {Misc}
#KEY F1 {#IF (!%ismember({smite @t},@do) & !%ismember({diag me},@dofree) & !%ismember({diag @h},@dofree)) {do smite @t}}
#ALIAS st {#VAR %1 %2;notice target %ansi(red,high)%upper(%1) %ansi(white)set to %ansi(red,high)%upper(%2)}
#ALIAS v {perform hands}
#ALIAS b {perform hands @h}
#ALIAS channelall {Simultaneity}
#ALIAS fb {#IF (%null(%1)) {do bless @h spiritshield earth;do bless @h willpower;do bless @h endurance;do bless @h spiritshield frost;do bless @h spiritshield thermal} {do bless %1 spiritshield earth;do bless %1 willpower;do bless %1 endurance;do bless %1 spiritshield frost;do bless %1 spiritshield thermal}}
#ALIAS aa {do angel aura}
#ALIAS wp {unwield left;unwield right;wield pole;take bass from baittank109857;do bait hook with @fishbait;do cast line @fishdir}
#TRIGGER {^Password correct. Welcome to Achaea.} {dofree insomnia;do selfishness;do angel summon;do deathsight}
#REGEX {^A .* scorpion jabs his stinger into your body and you wince in pain\.\nHm+\. Why must everything be so difficult to figure out\?} {dofree heal me stupidity}
#REGEX {^A .* scorpion jabs his stinger into your body and you wince in pain\.\nYour body stiffens rapidly with paralysis\.} {dofree heal me paralysis}
#TRIGGER {has been slain by (%w)} {#IF (@takegold) {#IF (%ismember(%1,{You|Iczamahr|Codin|Roh|Ghia|Mosr})) {#VAR mygold 1} {#VAR mygold 0}} {#VAR mygold 0}}
#TRIGGER {sovereigns {spills|spill} from the corpse} {#IF (@mygold) {dofree take gold}}
#TRIGGER {^({@mobs}%d)%s{a|an} *} {#SUB {~<send "st t %1"~>~<color white~>%1~</color~>~</send~>}} "" {notrig}
#TRIGGER {A spearhead shark opens its deadly mouth and clamps onto your leg} {dofree heal me legs}
#TRIGGER {^A * shard {appears and clatters to the ground|tumbles out of the corpse}} {#IF (@mygold & @takegold) {dofree take shard}}
#TRIGGER {^A * pearl tumbles out of the corpse} {#IF (@mygold & @takegold) {dofree take pearl}}
#TRIGGER {^A giant red scorpion jabs his stinger into your body and you burst into flame!} {dofree heal me burning}
#CLASS 0
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.