Semi-auto influencer for TF

by Unknown

Back to Mechanic's Corner.

Unknown2010-07-07 04:41:19
This is a semi-auto influencing script I used in tf. It can influence everything for you but you have to move your character manually. I think I adapted this code from someone a long time ago but I can't remember who.

CODE
;~@@@##% (^_^) %##@@@~; Begging;~@@@##% (^_^) %##@@@~;
; Use ABEG to automatically beg the target until you win. Use it again to disable auto-begging.
; Use ABEGGAR to automatically beg all targets in the room.

/set v_beg_count=0

/set v_beg_1=wheedling
/set v_beg_2=supplication
/set v_beg_3=begging


/def -p0 -mglob -h'SEND b' = \\
    /test v_beg_count += 1 %; \\
    /if (v_beg_count == 1) influence %v_inf_target with %v_beg_1 %; \\
    /elseif (v_beg_count == 2) influence %v_inf_target with %v_beg_2 %; \\
    /elseif (v_beg_count == 3) influence %v_inf_target with %v_beg_3 %; \\
        /set v_beg_count=0 %; \\
    /endif

; Auto Begging;

/set v_beg_auto=0
/def abeg = \\
    /if (v_beg_auto==0) /set v_beg_auto=1 %; /echo -ahCbrightgreen Hobo Mode On %; \\
        /elseif (v_beg_auto==1) /set v_beg_auto=0 %; /echo -ahCbrightred Hobo Mode Off %; \\
    /endif

/def -mregexp -E(v_beg_auto) \\
    -t"^You have recovered equilibrium\\." \\
    t_beg_auto = b

; @@@;

/set v_beggar=1

/def -mregexp -p1 -E(v_beggar) \\
   -t"sighs dramatically and searches (his|her) pockets" \\
    t_beg_auto_off = \\
    /if (v_beg_auto==1) /set v_beg_auto=0 %; /echo -ah Hobo Mode Off %; \\
    /endif

;@@ Begging Override @@;

/def abeggar = \\
    /if (v_beggar==1) /set v_beggar=0 %; /echo -ah -p Chain Begging @{BCbrightgreen}Activated %; \\
    /elseif (v_beggar==0) /set v_beggar=1) %; /echo -ah -p Chain Begging @{BCbrightred}Terminated. %; \\
    /endif

/def -mregexp \\
    -t"keeps asking (himself|herself) why (he|she) considered" \\
    t_beggar_done = \\
    /if (v_beggar==0) /set v_beggar=1 %; /set v_beg_auto=0 %; /echo -ah Chain Charity Terminated %; \\
    /endif


This is the target script I used:
CODE
;~@@@##% (^_^) %##@@@~; Targets;~@@@##% (^_^) %##@@@~;

/set v_inf_target=null

/def -p0 -mglob -h'SEND it *' = \\
    /set v_inf_target=%2 %; \\
    /echo -p @{BCcyan}Influence target set to: @{BCblue,Cbgwhite}%v_inf_target

Anyway, I'm switching over entirely to Mudlet now. It's been a while since I've done anything like this - any idea of how this code can be converted?
Unknown2010-07-07 08:41:38
Mudlet manual is very long. Color table under heading "fg( color_name )"
There's a debugger in Mudlet, so feel free to mess around. Ladybug icons appear on incorrect scripts.

Rough idea of variables (variables can be created anywhere. I like to have these in a Script "folder" instead of separate scripts)
CODE
v_beg = {"wheedling", "supplication", "begging"}
v_beg_count = 0
v_inf_target =
v_beg_auto = <0 or 1>
t_beg_auto =


You can shorten this "/def -p0 -mglob -h'SEND b' = \\" script to the following function in Scripts.
CODE
function charity_cycle()
  --using mod math and the v_beg array
  -- plus one at end because array index starts at 1
  v_beg_count = math.fmod(v_beg_count + 1, 3) + 1
  send("influence "..v_inf_target.." with "..v_beg)
end


Then call this in your equilibrium trigger with
CODE
charity_cycle()


Your autobeg switch and target switch would be under Aliases. Rest would go under Triggers. Mudlet uses Perl regexes. (\\w+) for an alphanumeric string; (\\d+) for a number; ^ for start of line $ for end of line; (.*) is wildcard. The (he|she)s you have are fine. I'm not sure how to color text quite the same way.

Autobeg switch would look something like
Alias name: autobeg
Pattern: ^abeg$
Substitution:
Code:
CODE
if (v_beg_auto==0) then
  -- turning on
  v_beg_auto = 1
  -- there's various ways to color messages; this one colors the whole string as one color
  cecho("Hobo Mode On\\n")
elseif (v_beg_auto==1) then
  -- turning off
  v_beg_auto = 0
  cecho("Hobo Mode Off\\n")
end


Target switch would be
Alias name: influence target
Pattern: ^it (\\w+)$
Substitution:
Code:
CODE
v_inf_target = matches
--there's an array called "matches" for when you have a regex pattern
--matches gives the whole string, "it " in this case
--matches would be the first string in parentheses, the that we want
Unknown2010-07-07 13:54:42
I will rip the influencer code I'm using and make it a generic thing anyone can use (stand alone, import xml and be done with it kind of thing) but it won't happen until tonight.
Unknown2010-07-07 14:04:52
May want to wait for demonnic's generic code. <_< Mine employs some not so good coding practices.

(Mudlet made it an .xml.xml) Save and import into Mudlet by going into the script editor, then clicking the green arrow down.
aliases to know:
it : targets
abeg: auto beg on/off switch
abeggar: auto chain beggar on/off switch
istart: actually starts influencing

Link because I can't seem to attach xmls
Unknown2010-07-07 19:55:43
Oh nice, thanks a lot! I don't think I could've came up with something like that. I tried making a script last night and it failed miserably =(

I'll try to use your code but I'll also wait for demonnic's. Thanks again smile.gif
Unknown2010-07-08 06:48:43
QUOTE (Shou @ Jul 7 2010, 03:55 PM) <{POST_SNAPBACK}>
Oh nice, thanks a lot! I don't think I could've came up with something like that. I tried making a script last night and it failed miserably =(

I'll try to use your code but I'll also wait for demonnic's. Thanks again smile.gif



See here for the bundle I put up in response to this. Sorry about the wait, let me know if that doesn't quite do it for you.