Convert this to mudlet kthx

... A place to ask for help on any topic whether it be starting out to player killing to IT issues.
Post Reply
Rig
Posts: 2294
Joined: Wed Dec 16, 2015 8:00 pm
Location: JESUS

Convert this to mudlet kthx

Post by Rig » Thu Mar 09, 2017 8:29 pm

#TRIGGER {^Your height is &%dstatFeet feet, &%dstatInches inches, and you weigh &statWeight lbs.} {
#MATH statTotalHeight (@statFeet*12)+@statInches
#MATH statHeightBMI @statTotalHeight*@statTotalHeight
#MATH statWeightBMI @statWeight*10
#MATH statBMI %float( @statWeightBMI)/%float( @statHeightBMI)
#IF (@showBMI) {#SUB {Your height is @statFeet feet, @statInches inches, and you weigh @statWeight lbs. Base BMI:%copy(@statBMI,3,2)}}
}

Adael
Posts: 1101
Joined: Sun Mar 22, 2015 12:34 am

Re: Convert this to mudlet kthx

Post by Adael » Fri Mar 10, 2017 12:27 am

This should be good enough.

Make a new trigger, name it RigSux.

copy/paste

^Your height is (\d+) feet, (\d+) inches, and you weigh (\d+)\.(\d+) lbs\.$

into the pattern box, change pattern type from substring to perl regex.

then copy/paste

deleteLine()
local inches=tonumber(matches[2])*12.0+tonumber(matches[3])
local meters=inches*2.54/100
local pounds=tonumber(matches[4])+tonumber(matches[5])/10.0
local kg=pounds*0.454
local bmi=kg/meters^2
echo("\nYour height is "..matches[2].." feet, "..matches[3].." inches, and you weigh "..matches[4].."."..matches[5].." lbs. BMI: "..bmi)

into the bigger box below.

maybe theres a cleaner way to do it but idk this works alright.

Rig
Posts: 2294
Joined: Wed Dec 16, 2015 8:00 pm
Location: JESUS

Re: Convert this to mudlet kthx

Post by Rig » Fri Mar 10, 2017 12:42 am

you are too smart

Brocas
Posts: 419
Joined: Fri Jul 01, 2016 10:08 am
Location: North Carolina

Re: Convert this to mudlet kthx

Post by Brocas » Fri Mar 10, 2017 12:26 pm

Does anyone have any general targeting scripts for mudlet?

Like something where you can do tgt mikhan and then your fireball, ice spike, etc weaves target mikhan?

Jomin
Posts: 160
Joined: Thu Feb 19, 2015 3:54 pm
Location: White Tower Libraries or Deepest Wiltshire, UK

Re: Convert this to mudlet kthx

Post by Jomin » Mon Mar 13, 2017 8:44 pm

You'd want an Alias - use ^tgt (\w+)$ as the "Pattern:" - which matches on you typing "tgt singleWordWithoutSpaces" then in the Lua Script area you can use something like:

Code: Select all

target = matches[2]
which then leaves a global value "target" that you can then use in your combat system e.g. you could assign

Code: Select all

if target and target ~= "" then
    send("kill "..target.."\n")
end
to a <Cntl>K "Key"... you could get fancy and write a "Trigger" to detect the R.I.P. message and then set target back to the empty string "" so that the combo stops being effective once the target dies...

Brocas
Posts: 419
Joined: Fri Jul 01, 2016 10:08 am
Location: North Carolina

Re: Convert this to mudlet kthx

Post by Brocas » Tue Mar 14, 2017 9:14 am

Thanks Jomin. I'll experiment!

Ara
Posts: 15
Joined: Sun Nov 27, 2016 9:17 pm

Re: Convert this to mudlet kthx

Post by Ara » Tue Mar 14, 2017 9:55 pm

Alias: Target
Pattern: ^tt (.+)$

target = matches[2]
target = string.title(target)
cecho("<light_blue>\nTarget set to -- " .. target .. " -- !\n\n")

**Note that target variable is not set to local

Alias: Ice Spikes
Pattern: ^is$

send("channel 'ice spikes' " ..target)

Alias: Call Lightning
Pattern: ^cl$

send("channel 'call lightning' " ..target)

and so on...

Jomin
Posts: 160
Joined: Thu Feb 19, 2015 3:54 pm
Location: White Tower Libraries or Deepest Wiltshire, UK

Re: Convert this to mudlet kthx

Post by Jomin » Thu Mar 16, 2017 6:57 pm

You might want to get fancy and add additional stuff to embrace before you cast your first weave; also you could detect weave success and fails and automatically retry on the latter; of course you may also need stuff to monitor your Saidar level and abort if unsafe to continue and to release when done - unless you deliberately want/need to hold a weave...

Post Reply