Simimi2007-05-15 00:00:32
Ok so, with everyone's help, I am really starting to understand this system making stuff, and I can see real progress!
My question is, I have a prompt trigger, to catch relevent information, suchthat:
It sends to my script the following information, suchthat:
The promptcheck function is something like...
Well I asked on IRC, and it was brought up "How does the promptcheck function know what %7 is?" Well that is a good question, I am using the string checks from the Mush website... suchthat:
Anyone know what it is I am missing? How -would- I pass that information to the function?
love,mimi
EDIT: Found this on another website...
My question is, I have a prompt trigger, to catch relevent information, suchthat:
CODE
^(\\d+)h\\, (\\d+)m\\, (\\d+)e\\, (\\d+)p\\, (\\d+)en\\, (\\d+)w\\ (.*)\\-$
It sends to my script the following information, suchthat:
CODE
var.health = "%1"
var.mana = "%2"
var.ego = "%3"
var.power = "%4"
var.endurance = "%5"
var.willpower = "%6"
promptcheck()
var.mana = "%2"
var.ego = "%3"
var.power = "%4"
var.endurance = "%5"
var.willpower = "%6"
promptcheck()
The promptcheck function is something like...
CODE
promptcheck()
    if string.match ("e", "%7", "(.*)")
        then var.equilibrium = 1
        end
    if string.match ("x", "%7", "(.*)")
        then var.balance = 1
        end
    if string.match ("e", "%7", "(.*)")
        then var.equilibrium = 1
        end
    if string.match ("x", "%7", "(.*)")
        then var.balance = 1
        end
Well I asked on IRC, and it was brought up "How does the promptcheck function know what %7 is?" Well that is a good question, I am using the string checks from the Mush website... suchthat:
CODE
Summary
Searches a string for a pattern
Prototype
s = string.match (str, pattern, index)
Description
Find the first match of the regular expression "pattern" in "str", starting at position "index".
If found, returns any captures in the pattern. If no captures were specified the entire matching string is returned.
If not found, returns nil.
This is similar to string.find, except that the starting and ending index are not returned.
print (string.match ("You see dogs and cats", "s..")) --> see
Searches a string for a pattern
Prototype
s = string.match (str, pattern, index)
Description
Find the first match of the regular expression "pattern" in "str", starting at position "index".
If found, returns any captures in the pattern. If no captures were specified the entire matching string is returned.
If not found, returns nil.
This is similar to string.find, except that the starting and ending index are not returned.
print (string.match ("You see dogs and cats", "s..")) --> see
Anyone know what it is I am missing? How -would- I pass that information to the function?
love,mimi
EDIT: Found this on another website...
CODE
string.match (s, pattern )
Unknown2007-05-15 00:45:16
%7 is a local variable. It exists only for the little snippet of code executed directly by that trigger. In order for a function (such as promptcheck) to be able to access that info, you need to put it into a global variable, like you did for %1-%6. Just add in the line:
then have your function check if "e" and "x" are in the promptstring variable. I don't know Lua, but it looks like you're getting the syntax for match wrong: the first argument should be the promptstring variable, the second argument is the thing you're looking for (like "e" or "x"). From that example, it looks like you can leave out the index argument, but the index would be a number stating where in the string to start, nothing like (.*). (.*) isn't a part of your string at all, it's just a special flag in your trigger for something you want to capture. I'm guessing your function should look something like:
CODE
var.promptstring = "%7"
then have your function check if "e" and "x" are in the promptstring variable. I don't know Lua, but it looks like you're getting the syntax for match wrong: the first argument should be the promptstring variable, the second argument is the thing you're looking for (like "e" or "x"). From that example, it looks like you can leave out the index argument, but the index would be a number stating where in the string to start, nothing like (.*). (.*) isn't a part of your string at all, it's just a special flag in your trigger for something you want to capture. I'm guessing your function should look something like:
CODE
promptcheck()
    if string.match (var.promptstring, "e")
        then var.equilibrium = 1
        end
    if string.match (var.promptstring, "x")
        then var.balance = 1
        end
    if string.match (var.promptstring, "e")
        then var.equilibrium = 1
        end
    if string.match (var.promptstring, "x")
        then var.balance = 1
        end
Unknown2007-05-15 01:29:34
When your trigger calls your prompt handling function, you will pass it three arguments: the name of the trigger, the matched line, and the wildcards.
So, for instance, my prompt handling function starts like this:
In the collection of wildcards will be your various bits of information, as you seem to have already gotten a handle on.
If you want to use yet another function to look for balance, eq, and such, you will need to pass that function your last wildcard, so it might look like this:
Then your promptcheck function:
Note that your index should be 0, not another pattern of characters. It's a position number, and 0 is the beginning of the string.
But I just do everything in one function for prompt handling, myself.
Also, I use string.find instead of string.match, because I don't actually need the match back; I just need to know if it was found. So, my statements look like this:
So, for instance, my prompt handling function starts like this:
CODE
function PromptHandler(name, line, wildcards)
In the collection of wildcards will be your various bits of information, as you seem to have already gotten a handle on.
If you want to use yet another function to look for balance, eq, and such, you will need to pass that function your last wildcard, so it might look like this:
CODE
var.health = "%1"
var.mana = "%2"
var.ego = "%3"
var.power = "%4"
var.endurance = "%5"
var.willpower = "%6"
promptcheck("%7")
var.mana = "%2"
var.ego = "%3"
var.power = "%4"
var.endurance = "%5"
var.willpower = "%6"
promptcheck("%7")
Then your promptcheck function:
CODE
function promptcheck(mypromptstring)
    if string.match ("e", mypromptstring, 0)
        then var.equilibrium = 1
        end
    if string.match ("x", mypromptstring, 0)
        then var.balance = 1
        end
... so on so forth
    if string.match ("e", mypromptstring, 0)
        then var.equilibrium = 1
        end
    if string.match ("x", mypromptstring, 0)
        then var.balance = 1
        end
... so on so forth
Note that your index should be 0, not another pattern of characters. It's a position number, and 0 is the beginning of the string.
But I just do everything in one function for prompt handling, myself.
Also, I use string.find instead of string.match, because I don't actually need the match back; I just need to know if it was found. So, my statements look like this:
CODE
-- Do I have eq?
    if string.find(statuses, "e") then
        MushVars.HasBalance_Equilibrium = 1
    else
        MushVars.HasBalance_Equilibrium = 0
    end -- if
    if string.find(statuses, "e") then
        MushVars.HasBalance_Equilibrium = 1
    else
        MushVars.HasBalance_Equilibrium = 0
    end -- if
Simimi2007-05-15 03:44:05
Wow thanks for the replies!
Is there a difference in using string.match and string.find, really? Is one more effecient then the other?
So this is what I have so far...
I am not sure if that is all I can do with a prompt or not. I am particularly curious about sixthsense. I hope the extra ifs I threw in there will handle it for now until I think of a superior solution. My system is just barely getting started so there is not much done, but it is really coming along so far.
I dun know why it is not aligning those up right, they are not like that in the script file...
Anyway, How does it look? Thumbs up, thumbs down? Things I can do better? Suggestions for the future?
Is there a difference in using string.match and string.find, really? Is one more effecient then the other?
So this is what I have so far...
CODE
function promptcheck()
    if string.find (var.promptstring, "e")
                then var.equilibrium = 1
            else var.equilibrium = 0
                end
    if string.find (var.promptstring, "x")
                then var.balance = 1
            else var.balance = 0
                end
    if string.find (var.promptstring, "p")
        then var.prone = 1
            else var.prone = 0
        end
    if string.find (var.promptstring, "b")
        then var.blindness = 1
            else var.blindness = 0
        or if var.sixthsense =1 and
            var.blindness = 1
                then var.sixthsense =1 and var.blindness = 0
        end    Â
    if string.find (var.promptstring, "l")
        then var.leftarmbalance = 1
            else var.leftarmbalance = 0
        end
    if string.find (var.promptstring, "r")
        then var.rightarmbalance = 1
            else var.rightarmbalance = 0
        end
    if string.find (var.promptstring, "k")
        then var.kafe = 1
            else var.kafe = 0
        end
    if string.find (var.promptstring, "d")
        then var.deaf = 1
            else var.deaf = 0
        end
end
    if string.find (var.promptstring, "e")
                then var.equilibrium = 1
            else var.equilibrium = 0
                end
    if string.find (var.promptstring, "x")
                then var.balance = 1
            else var.balance = 0
                end
    if string.find (var.promptstring, "p")
        then var.prone = 1
            else var.prone = 0
        end
    if string.find (var.promptstring, "b")
        then var.blindness = 1
            else var.blindness = 0
        or if var.sixthsense =1 and
            var.blindness = 1
                then var.sixthsense =1 and var.blindness = 0
        end    Â
    if string.find (var.promptstring, "l")
        then var.leftarmbalance = 1
            else var.leftarmbalance = 0
        end
    if string.find (var.promptstring, "r")
        then var.rightarmbalance = 1
            else var.rightarmbalance = 0
        end
    if string.find (var.promptstring, "k")
        then var.kafe = 1
            else var.kafe = 0
        end
    if string.find (var.promptstring, "d")
        then var.deaf = 1
            else var.deaf = 0
        end
end
I am not sure if that is all I can do with a prompt or not. I am particularly curious about sixthsense. I hope the extra ifs I threw in there will handle it for now until I think of a superior solution. My system is just barely getting started so there is not much done, but it is really coming along so far.
I dun know why it is not aligning those up right, they are not like that in the script file...
Anyway, How does it look? Thumbs up, thumbs down? Things I can do better? Suggestions for the future?
Unknown2007-05-15 06:16:09
QUOTE(Simimi @ May 15 2007, 04:44 AM) 407824
Anyway, How does it look? Thumbs up, thumbs down? Things I can do better? Suggestions for the future?
You'll probably want to draw more inferences from your prompt. For instance, if there's no "p" on your prompt, you know you're not roped, entangled, fallen or paralysed and can set those variables to 0. You can also save the values from your previous prompt to separate variables, and compare your current and previous prompts to figure out if you're reckless, or to maybe even work it into how you sip/apply/eat sparkles/use scrolls, etc...
If I were you, I'd track blindness separately from sixthsense. If you reset blindness to 0 when sixthsense = 1 and you fail to track losing sixthsense (or run into the unfortunate arena bug regarding it), you may wind up not curing blindness at all.
Unknown2007-05-15 10:48:42
When putting your code to set the variables inside the if-then-else, don't use "and" to join two commands. That's only used for the expression in the if-then-else.
As vale_kant says, you'll want to track sixth sense and true hearing separately and just use them in your functions for curing.
CODE
function promptcheck()
  if string.find (var.promptstring, "e") then
    var.equilibrium = 1
  else
    var.equilibrium = 0
  end
  if string.find (var.promptstring, "x") then
    var.balance = 1
  else
    var.balance = 0
  end
-- Probably want to do something here with a precursor trigger
-- to see what sort of prone the "p" might be (impaled, entangled,
-- etc) and then track that.
  if string.find (var.promptstring, "p") then
    var.prone = 1
  else
    var.prone = 0
  end
  if string.find (var.promptstring, "b") then
    var.blindness = 1
  else
    var.blindness = 0
  end
  if string.find (var.promptstring, "l")  then
    var.leftarmbalance = 1
  else
    var.leftarmbalance = 0
  end
  if string.find (var.promptstring, "r") then
    var.rightarmbalance = 1
  else
    var.rightarmbalance = 0
  end
  if string.find (var.promptstring, "k") then
    var.kafe = 1
  else
    var.kafe = 0
  end
  if string.find (var.promptstring, "d") then
    var.deaf = 1
  else
    var.deaf = 0
  end
end
  if string.find (var.promptstring, "e") then
    var.equilibrium = 1
  else
    var.equilibrium = 0
  end
  if string.find (var.promptstring, "x") then
    var.balance = 1
  else
    var.balance = 0
  end
-- Probably want to do something here with a precursor trigger
-- to see what sort of prone the "p" might be (impaled, entangled,
-- etc) and then track that.
  if string.find (var.promptstring, "p") then
    var.prone = 1
  else
    var.prone = 0
  end
  if string.find (var.promptstring, "b") then
    var.blindness = 1
  else
    var.blindness = 0
  end
  if string.find (var.promptstring, "l")  then
    var.leftarmbalance = 1
  else
    var.leftarmbalance = 0
  end
  if string.find (var.promptstring, "r") then
    var.rightarmbalance = 1
  else
    var.rightarmbalance = 0
  end
  if string.find (var.promptstring, "k") then
    var.kafe = 1
  else
    var.kafe = 0
  end
  if string.find (var.promptstring, "d") then
    var.deaf = 1
  else
    var.deaf = 0
  end
end
As vale_kant says, you'll want to track sixth sense and true hearing separately and just use them in your functions for curing.
CODE
function herb_cure()
-- Just a sample...
  if (var.blindness and not var.sixthsense) or
    (var.deafness and not var.truehearing) then
    Send("outr myrtle\\neat myrtle")
  end
end
-- Just a sample...
  if (var.blindness and not var.sixthsense) or
    (var.deafness and not var.truehearing) then
    Send("outr myrtle\\neat myrtle")
  end
end
Simimi2007-05-15 16:31:27
Ok! Thanks for everything (once again...). I am not sure how to go about this though...
so something like...
And then the proncheck function could be like...
Something like that? I am on the right track? Due to my lack of knowledge of fighting in Lusternia, I am noticing it really hinders my system making ability, simply because I do not know how things "work". But, I'm not giving up.
CODE
-- Probably want to do something here with a precursor trigger
-- to see what sort of prone the "p" might be (impaled, entangled,
-- etc) and then track that.
-- to see what sort of prone the "p" might be (impaled, entangled,
-- etc) and then track that.
so something like...
CODE
if var.prone = 1 then
      pronecheck()
      pronecheck()
And then the proncheck function could be like...
CODE
function pronecheck()
    if var.prone = 1 and var.impaled = 1 then
        send ("writhe")
    end
    if var.prone = 1 and var.entangled = 1 then
        send ("writhe")
    end
end
    if var.prone = 1 and var.impaled = 1 then
        send ("writhe")
    end
    if var.prone = 1 and var.entangled = 1 then
        send ("writhe")
    end
end
Something like that? I am on the right track? Due to my lack of knowledge of fighting in Lusternia, I am noticing it really hinders my system making ability, simply because I do not know how things "work". But, I'm not giving up.
Unknown2007-05-15 18:43:25
It's not foolproof, but here's a method you might try:
1. See a message about something, such as "So-and-so entangles you." or "Such-and-such trips you and you fall down." to set a temporary (script) variable for what sort of "prone" it will be (i.e., prone_check = entangled).
2. On the prompt, if there's a "p" in the flags and your prone_check variable has something in it, add this new affliction to your list. So, if you think you've just been entangled, now you know whether you are or not. (This is where the logic is slightly flawed because you might already have had the "p" from another prone affliction.)
3. On every prompt, regardless of the "p" flag, reset the prone_check variable.
4. The affliction named "prone" should only be used for when you need to stand up. Other prone-type afflictions have their own name: entangled, impaled, roped, etc.
5. If there is no "p" in the prompt flags, remove all prone-type afflictions from your list of afflictions.
1. See a message about something, such as "So-and-so entangles you." or "Such-and-such trips you and you fall down." to set a temporary (script) variable for what sort of "prone" it will be (i.e., prone_check = entangled).
2. On the prompt, if there's a "p" in the flags and your prone_check variable has something in it, add this new affliction to your list. So, if you think you've just been entangled, now you know whether you are or not. (This is where the logic is slightly flawed because you might already have had the "p" from another prone affliction.)
3. On every prompt, regardless of the "p" flag, reset the prone_check variable.
4. The affliction named "prone" should only be used for when you need to stand up. Other prone-type afflictions have their own name: entangled, impaled, roped, etc.
5. If there is no "p" in the prompt flags, remove all prone-type afflictions from your list of afflictions.
Simimi2007-05-16 02:00:43
Ok I have an idea for what you said, Zarquan, but it will require me getting the lines for those afflictions. I am currently hunting down lines for various things. Hopefully my idea will work.
Rather than starting yet another thread for help, I might as well just keep this one going. I just finished work on what was sort of going to be an autosipper. I have the prompt trigger run the function autosipper() such that:
I was not sure how to divy up priority, and so my beloved irc peoples said just give a variable for priority so I called that variable var.sipsequence, which can be = to 0 (for health), 1 (for mana), or 2 (for ego).
I assume this would be basically effecient until I can think of a superior way anyway.
Rather than starting yet another thread for help, I might as well just keep this one going. I just finished work on what was sort of going to be an autosipper. I have the prompt trigger run the function autosipper() such that:
CODE
--*Autosipper
function autosipper ()
if var.sipsequence = 0 then
    if ..health <= (.90 * ..maxhealth) and ..potionbalance ==  1  then
        Send ("drink health")
            end
    else if ..health <= (.75 * ..maxhealth) and ..potionbalance == 1 then
        Send ("drink health")
            end
end
if var.sipsequence = 1 then
    if ..mana <= (.90 * ..maxmana) and ..potionbalance == 1 then
        Send ("drink mana")
            end
    else if ..mana <= (.75* ..maxmana) and ..potionbalance == 1 then
        Send ("drink mana")
            end
end
if var.sipsequence = 2 then
    if ..ego <= (.90 * ..maxego) and ..potionbalance == 1 then
        Send ("drink ego")
            end
    else if ..ego <= (.75* ..maxego) and ..potionbalance == 1 then
        Send ("drink ego")
            end
end
function autosipper ()
if var.sipsequence = 0 then
    if ..health <= (.90 * ..maxhealth) and ..potionbalance ==  1  then
        Send ("drink health")
            end
    else if ..health <= (.75 * ..maxhealth) and ..potionbalance == 1 then
        Send ("drink health")
            end
end
if var.sipsequence = 1 then
    if ..mana <= (.90 * ..maxmana) and ..potionbalance == 1 then
        Send ("drink mana")
            end
    else if ..mana <= (.75* ..maxmana) and ..potionbalance == 1 then
        Send ("drink mana")
            end
end
if var.sipsequence = 2 then
    if ..ego <= (.90 * ..maxego) and ..potionbalance == 1 then
        Send ("drink ego")
            end
    else if ..ego <= (.75* ..maxego) and ..potionbalance == 1 then
        Send ("drink ego")
            end
end
I was not sure how to divy up priority, and so my beloved irc peoples said just give a variable for priority so I called that variable var.sipsequence, which can be = to 0 (for health), 1 (for mana), or 2 (for ego).
I assume this would be basically effecient until I can think of a superior way anyway.
Unknown2007-05-16 02:12:30
QUOTE(Simimi @ May 15 2007, 09:00 PM) 408272
Ok I have an idea for what you said, Zarquan, but it will require me getting the lines for those afflictions. I am currently hunting down lines for various things. Hopefully my idea will work.
Rather than starting yet another thread for help, I might as well just keep this one going. I just finished work on what was sort of going to be an autosipper. I have the prompt trigger run the function autosipper() such that:
I was not sure how to divy up priority, and so my beloved irc peoples said just give a variable for priority so I called that variable var.sipsequence, which can be = to 0 (for health), 1 (for mana), or 2 (for ego).
I assume this would be basically effecient until I can think of a superior way anyway.
Rather than starting yet another thread for help, I might as well just keep this one going. I just finished work on what was sort of going to be an autosipper. I have the prompt trigger run the function autosipper() such that:
CODE
--*Autosipper
function autosipper ()
if var.sipsequence = 0 then
    if ..health <= (.90 * ..maxhealth) and ..potionbalance ==  1  then
        Send ("drink health")
            end
    else if ..health <= (.75 * ..maxhealth) and ..potionbalance == 1 then
        Send ("drink health")
            end
end
if var.sipsequence = 1 then
    if ..mana <= (.90 * ..maxmana) and ..potionbalance == 1 then
        Send ("drink mana")
            end
    else if ..mana <= (.75* ..maxmana) and ..potionbalance == 1 then
        Send ("drink mana")
            end
end
if var.sipsequence = 2 then
    if ..ego <= (.90 * ..maxego) and ..potionbalance == 1 then
        Send ("drink ego")
            end
    else if ..ego <= (.75* ..maxego) and ..potionbalance == 1 then
        Send ("drink ego")
            end
end
function autosipper ()
if var.sipsequence = 0 then
    if ..health <= (.90 * ..maxhealth) and ..potionbalance ==  1  then
        Send ("drink health")
            end
    else if ..health <= (.75 * ..maxhealth) and ..potionbalance == 1 then
        Send ("drink health")
            end
end
if var.sipsequence = 1 then
    if ..mana <= (.90 * ..maxmana) and ..potionbalance == 1 then
        Send ("drink mana")
            end
    else if ..mana <= (.75* ..maxmana) and ..potionbalance == 1 then
        Send ("drink mana")
            end
end
if var.sipsequence = 2 then
    if ..ego <= (.90 * ..maxego) and ..potionbalance == 1 then
        Send ("drink ego")
            end
    else if ..ego <= (.75* ..maxego) and ..potionbalance == 1 then
        Send ("drink ego")
            end
end
I was not sure how to divy up priority, and so my beloved irc peoples said just give a variable for priority so I called that variable var.sipsequence, which can be = to 0 (for health), 1 (for mana), or 2 (for ego).
I assume this would be basically effecient until I can think of a superior way anyway.
A couple of observations:
1) I'm not sure how you're intending to use sipsequence, but as it stands, you will -only- sip health or mana or ego. If sipsequence is 2, for instance, it'll never trip the logic for sipping health or mana.
2) Did that go through the parser ok? If you're using Lua, if...elseif statements look like this:
CODE
if blah then
  stuff
elseif (NOTE: elseif is one word, and there is no "end" before it)
  other stuff
end
  stuff
elseif (NOTE: elseif is one word, and there is no "end" before it)
  other stuff
end
Unknown2007-05-16 03:12:09
A quick note: some impalements don't put a "p" on your prompt. Always forget which, but I think being on a cross or impaled through the gut shows a "p" while pinleg doesn't. Never been gored, so I wouldn't know. Someone correct me? *coughZarquan*
The way I handle sipping priorities is in a single big if-structure, by amount of damage to each stat. So, I have one big if that goes:
Do I have sip balance? -> Yes
- Am I under half health? -> Yes, sip health, else:
- Do I have really bad deepwounds on these limbs? -> Yes, apply health, else:
- Am I under half mana? -> Yes, sip mana, else:
- Am I under half ego? -> Yes, sip bromides, else:
- Do I have bad deepwounds on these limbs? -> Yes, apply health, else:
- Am I under 85% health? -> Yes, sip health, else:
- Am I under 85% ego? -> Yes, sip bromides, else:
- Am I under 85% mana? -> Yes, sip mana, etc...
It's much more detailed, but you get the idea. It's partly based on the assumption that, as a faeling, I'm usually worried about health, and I won't be really low on mana or ego unless someone's trying to drain those to instakill me, so I can always bump those in priority when I get low on them. Dunno if that's ideal or if that applies well to low mana/ego races, but the logic's worked quite well for me.
A final note: In the future, when you've got things working, you'll also want to include a means of resetting balances, such as timers. If you rely on seeing balance-regain lines to set your balances back to 0, you're very very vulnerable to illusions. If someone illusions "You eat a sprig of so-and-so" and that sets your herb balance to 1, then you'll never see a "You have regained herb balance" line, and your system will keep assuming you don't have herb balance. So, when you send a command to sip health or eat an herb or whatever, you'll want to set the corresponding balance to 1 and have some means of resetting it after 4 sec or so. I do it with a little timer that fires after 4 sec, but having lots of timers can cause lag. Not something to worry about now, but definitely something to address in the future.
The way I handle sipping priorities is in a single big if-structure, by amount of damage to each stat. So, I have one big if that goes:
Do I have sip balance? -> Yes
- Am I under half health? -> Yes, sip health, else:
- Do I have really bad deepwounds on these limbs? -> Yes, apply health, else:
- Am I under half mana? -> Yes, sip mana, else:
- Am I under half ego? -> Yes, sip bromides, else:
- Do I have bad deepwounds on these limbs? -> Yes, apply health, else:
- Am I under 85% health? -> Yes, sip health, else:
- Am I under 85% ego? -> Yes, sip bromides, else:
- Am I under 85% mana? -> Yes, sip mana, etc...
It's much more detailed, but you get the idea. It's partly based on the assumption that, as a faeling, I'm usually worried about health, and I won't be really low on mana or ego unless someone's trying to drain those to instakill me, so I can always bump those in priority when I get low on them. Dunno if that's ideal or if that applies well to low mana/ego races, but the logic's worked quite well for me.
A final note: In the future, when you've got things working, you'll also want to include a means of resetting balances, such as timers. If you rely on seeing balance-regain lines to set your balances back to 0, you're very very vulnerable to illusions. If someone illusions "You eat a sprig of so-and-so" and that sets your herb balance to 1, then you'll never see a "You have regained herb balance" line, and your system will keep assuming you don't have herb balance. So, when you send a command to sip health or eat an herb or whatever, you'll want to set the corresponding balance to 1 and have some means of resetting it after 4 sec or so. I do it with a little timer that fires after 4 sec, but having lots of timers can cause lag. Not something to worry about now, but definitely something to address in the future.
Simimi2007-05-16 04:54:26
Hmm well as a Dracnari, I will need to add in the fact that my sip penalty is horrendous.
Well the intention of sipsequence was to give me a way to set priority amongst the three needed sips, health mana ego...
I have not run anything through the parser yet (no idea how), I am just kind of typing along as I think of things that need to be done...
I may try that and see if it is any better than the one I was working on now. The main thing is that I want to be able to easily adjust priority if I run into an adverse situation which puts my Dracnari sip penalty into a bad situation, where it might be used against me. I'll post a new scripty as soon as I write one...
QUOTE(Demetrios)
1) I'm not sure how you're intending to use sipsequence, but as it stands, you will -only- sip health or mana or ego. If sipsequence is 2, for instance, it'll never trip the logic for sipping health or mana.
Well the intention of sipsequence was to give me a way to set priority amongst the three needed sips, health mana ego...
QUOTE(Demetrios)
2) Did that go through the parser ok?
I have not run anything through the parser yet (no idea how), I am just kind of typing along as I think of things that need to be done...
QUOTE(Vale_Kant)
The way I handle sipping priorities is in a single big if-structure, by amount of damage to each stat. So, I have one big if that goes:
I may try that and see if it is any better than the one I was working on now. The main thing is that I want to be able to easily adjust priority if I run into an adverse situation which puts my Dracnari sip penalty into a bad situation, where it might be used against me. I'll post a new scripty as soon as I write one...
Unknown2007-05-16 05:05:13
QUOTE(Simimi @ May 15 2007, 11:54 PM) 408395
Well the intention of sipsequence was to give me a way to set priority amongst the three needed sips, health mana ego...
Hmm. Well, the way you have it now, it doesn't prioritize the three so much as shut the other two off.
Are you wanting to change priorities on the fly? If not, you could just put your three blocks in the order that you want. If the first one trips, you won't have balance and the others won't. If the first one doesn't trip, it'll go on to the next one.
If you're wanting to change priorities on the fly, it's a bit more work.
QUOTE
I have not run anything through the parser yet (no idea how), I am just kind of typing along as I think of things that need to be done...
I know what you mean. For myself, I found that, overall, I saved myself time by loading into the parser frequently as well as using MushClient's ability to test triggers without logging in. It's a bit of a hassle at first, but a lot less hassle than debugging my code in real time.
Simimi2007-05-16 06:33:52
CODE
--*Autosipper
function autosipper ()
if ..potionbalance == 1 then
    end
    if ..health <= (.50 * ..maxhealth) then
        Send ("drink health")
    elseif --really bad deepwounds stuffs here, no idea what the lines and such for those are...or how to handle them, or what deepwounds are even...
        --Send ("apply health to --wounded spot")
    elseif ..mana <= (.50 * ..maxmana) then
        Send ("drink mana")
    elseif ..ego <= (.50 * maxego) then
        Send ("drink mana")
    elseif --more deepwounds stuff once I learn about it
        --Send ("deepwounds cure stuffs")
    elseif ..health <= (.65 * ..maxhealth) then
        Send ("drink health")
    elseif ..mana <= (.65 * ..maxmana) then
        Send ("drink mana")
    elseif ..ego <= (.65 * ..maxego) then
        Send ("drink ego")
    elseif .. --less bad deepwounds stuffs here
        --Send ("lessbad deepwounds stuffs")
    elseif ..health <= (.80 * ..maxhealth) then
        Send ("drink health")
    elseif ..mana <= (.80 * ..maxmana) then
        Send ("drink mana")
    elseif ..ego <= (.80 * ..maxego) then
        Send ("drink ego")
end
function autosipper ()
if ..potionbalance == 1 then
    end
    if ..health <= (.50 * ..maxhealth) then
        Send ("drink health")
    elseif --really bad deepwounds stuffs here, no idea what the lines and such for those are...or how to handle them, or what deepwounds are even...
        --Send ("apply health to --wounded spot")
    elseif ..mana <= (.50 * ..maxmana) then
        Send ("drink mana")
    elseif ..ego <= (.50 * maxego) then
        Send ("drink mana")
    elseif --more deepwounds stuff once I learn about it
        --Send ("deepwounds cure stuffs")
    elseif ..health <= (.65 * ..maxhealth) then
        Send ("drink health")
    elseif ..mana <= (.65 * ..maxmana) then
        Send ("drink mana")
    elseif ..ego <= (.65 * ..maxego) then
        Send ("drink ego")
    elseif .. --less bad deepwounds stuffs here
        --Send ("lessbad deepwounds stuffs")
    elseif ..health <= (.80 * ..maxhealth) then
        Send ("drink health")
    elseif ..mana <= (.80 * ..maxmana) then
        Send ("drink mana")
    elseif ..ego <= (.80 * ..maxego) then
        Send ("drink ego")
end
Better? What do you mean about checking triggers without logging in? Seems like it would be very useful!
Unknown2007-05-16 11:07:05
Do not use the .. in your code like that. The .. is a string concatenation operator and not meant to be used this way.
There's a trigger test option on the menu that allows you to display text just as it would appear from the game and see if your trigger fires and does what you expect without ever connecting.
There's a trigger test option on the menu that allows you to display text just as it would appear from the game and see if your trigger fires and does what you expect without ever connecting.
Unknown2007-05-16 14:34:39
Don't worry about the deepwounds for now. You'll need a lot of work and triggers and understanding of warrior combat to handle those, and you'll probably want to call a whole separate function when you want to apply health. You'll probably want to get your autosipper, writhing, herb/salve/potion/focus curing to work first. They're much simpler and bigger priorities.
vorld2007-05-16 15:15:49
that looks complicated
Unknown2007-05-16 15:19:22
It's not that complicated. You can make a simple sipper with just three lines of code, but it won't be as useful as one with more logic to separate the sipping into tiers. Putting this type of logic into Lua is easier than something like zMUD scripting, I think.
Simimi2007-05-16 19:06:38
So what is the ..blah concatenation operator for? I thought it was like using @blah, to expand a variable within a string... So for all of those I would need to justy use var.ego and var.maxego, etc etc, then?
Ok I will work on getting my herb and salve and potion and writhing in first then, at least now I have some minor direction. Thanks so much yet again!
Ok I will work on getting my herb and salve and potion and writhing in first then, at least now I have some minor direction. Thanks so much yet again!
Unknown2007-05-16 19:18:09
QUOTE(Simimi @ May 16 2007, 02:06 PM) 408694
So what is the ..blah concatenation operator for?
It's used to put two strings together. E.g.
CODE
function ResetBalance(balancename)
  SetVariable("HasBalance_" .. balancename, "1")
end
  SetVariable("HasBalance_" .. balancename, "1")
end