Simimi2006-10-22 19:21:10
So, I have been reading through the mush client forums a lot lately, looking for help on making my system. I would feel bad for cribbing from Ethelon on his free one, but I want him to know I am using his afflict lines, instead of collecting them all myself. Hope you don't mind...
1) First things first... I came across this, and I want to know if it could be used for afflictions, and if so, how, and if so, would it be a good way to do it, or is there a better way? http://www.gammon.com.au/forum/?id=4904
2) Second thing, I am working on a tarot script for making tarot cards... it is the first thing I am really trying to to that is productive and it is proving to be a lot harder than I thought it would. This is the basic rundown...
*********************ALIAS***********************
cardmake * *
setvariable ("tarot_cards_to_make", "%1")
set variable ("tarot_card_style" , "%2")
EnableTrigger "TarotMakingTrigger" , TRUE
*************************************************
*******************TRIGGER**********************
^You have recovered balance on all limbs\\.$
if (getvariable ("tarot_cards_to_make") > 0) then
Call cardmaker()
elseif if (getvariable ("tarot_cards_to_make") > 0) then
EnableTrigger "TarotMakingTrigger", FALSE
end if
*has the label TarotMakingTrigger
************************************************
*****************SCRIPT************************
sub cardmaker()
send "outd blank"
send "inscribe blank with " + getvariable ("tarot_card_style")
send "ind " + getvariable ("tarot_card_style")
setvarable "tarot_cards_to_make", getvariable ("tarot_cards_to_make")
setvariable "tarot_cards_painted", getvariable ("tarot_cards_to_make") - 1
end sub
************************************************
***************Variables*************************
tarot_card_style
tarot_cards_to_paint
tarot_cards_painted
************************************************
Now, this was wrote by Tervic for me to look at and study on, in VBscript. I tried to change it to Lua, as I think I might try to use Lua as my scripting language, since I do not know any of them, and would be learning as I go. Not even sure if THAT is a good idea or not...
3) How do we trap things and gag them to display something new? I read something on the forums here about it (and have it bookmarked) but I did not understand it... an example would be for potionlist.
I want my potionlist to display the "Need Blah" like it does for Ethelon's but I also want it to capture the info, like in a variable, and relay back to me instead of how it looks now-
Id Vial Potion Sips Months
30441 a beryl vial empty 0 70
31918 a beryl vial empty 0 70
32327 a beryl vial empty 0 70
It would give me
Potion # Sips Months
Empty 4 0 340
Health 7 438 216
But then I want to be able to do like pln to give me a normal potion list, but like pl to give this compressed one? Or maybe have my total potionlist that is linked to pl be setable? So I could do like setpotionlist big/small?
Anywhere, there are about a million other things I am struggling with, but those are the bigger ones. Thanks for everything in advance...
Love,mimi
EDIT: I also found this http://www.gammon.com.au/forum/?id=6074 for healing...looks promising, any thoughts on it that would be the msot effective, or effective enough way of doing things?
1) First things first... I came across this, and I want to know if it could be used for afflictions, and if so, how, and if so, would it be a good way to do it, or is there a better way? http://www.gammon.com.au/forum/?id=4904
2) Second thing, I am working on a tarot script for making tarot cards... it is the first thing I am really trying to to that is productive and it is proving to be a lot harder than I thought it would. This is the basic rundown...
*********************ALIAS***********************
cardmake * *
setvariable ("tarot_cards_to_make", "%1")
set variable ("tarot_card_style" , "%2")
EnableTrigger "TarotMakingTrigger" , TRUE
*************************************************
*******************TRIGGER**********************
^You have recovered balance on all limbs\\.$
if (getvariable ("tarot_cards_to_make") > 0) then
Call cardmaker()
elseif if (getvariable ("tarot_cards_to_make") > 0) then
EnableTrigger "TarotMakingTrigger", FALSE
end if
*has the label TarotMakingTrigger
************************************************
*****************SCRIPT************************
sub cardmaker()
send "outd blank"
send "inscribe blank with " + getvariable ("tarot_card_style")
send "ind " + getvariable ("tarot_card_style")
setvarable "tarot_cards_to_make", getvariable ("tarot_cards_to_make")
setvariable "tarot_cards_painted", getvariable ("tarot_cards_to_make") - 1
end sub
************************************************
***************Variables*************************
tarot_card_style
tarot_cards_to_paint
tarot_cards_painted
************************************************
Now, this was wrote by Tervic for me to look at and study on, in VBscript. I tried to change it to Lua, as I think I might try to use Lua as my scripting language, since I do not know any of them, and would be learning as I go. Not even sure if THAT is a good idea or not...
3) How do we trap things and gag them to display something new? I read something on the forums here about it (and have it bookmarked) but I did not understand it... an example would be for potionlist.
I want my potionlist to display the "Need Blah" like it does for Ethelon's but I also want it to capture the info, like in a variable, and relay back to me instead of how it looks now-
Id Vial Potion Sips Months
30441 a beryl vial empty 0 70
31918 a beryl vial empty 0 70
32327 a beryl vial empty 0 70
It would give me
Potion # Sips Months
Empty 4 0 340
Health 7 438 216
But then I want to be able to do like pln to give me a normal potion list, but like pl to give this compressed one? Or maybe have my total potionlist that is linked to pl be setable? So I could do like setpotionlist big/small?
Anywhere, there are about a million other things I am struggling with, but those are the bigger ones. Thanks for everything in advance...
Love,mimi
EDIT: I also found this http://www.gammon.com.au/forum/?id=6074 for healing...looks promising, any thoughts on it that would be the msot effective, or effective enough way of doing things?
Unknown2006-10-23 02:52:12
QUOTE
1) First things first... I came across this, and I want to know if it could be used for afflictions, and if so, how, and if so, would it be a good way to do it, or is there a better way? http://www.gammon.com.au/forum/?id=4904
That stores each value in a separate Mushclient variable, and afflictions are usually stored in a table, since that's more convenient for lookup:
CODE
afflictions = {}
afflictions.paralysed = true
if afflictions.paralysed then Note("You are paralysed!") end
Besides, the only reason to store afflictions in Mushclient variables is to ensure that they persist between sessions, since that's about the only advantage these variables have over internal Lua ones - the latter are discarded every time you close the client. But if you wanted to persist afflictions, you could just as well use the serialize.lua module supplied with Mushclient 3.80 and later.
QUOTE
2) Second thing, I am working on a tarot script for making tarot cards... it is the first thing I am really trying to to that is productive and it is proving to be a lot harder than I thought it would. This is the basic rundown...
When translating Vbscript code to Lua you have to keep 2 simple rules in mind:
1. Lua is case-sensitive and Mushclient callbacks use CamelCase.
2. Lua requires parenthesis around function arguments in all cases, with a single, mostly irrelevant, exception.
With those rules in mind, the script for the alias would look like this in Lua:
CODE
SetVariable ("tarot_cards_to_make", "%1")
SetVariable ("tarot_card_style" , "%2")
EnableTrigger ("TarotMakingTrigger" , true)
SetVariable ("tarot_card_style" , "%2")
EnableTrigger ("TarotMakingTrigger" , true)
QUOTE
3) How do we trap things and gag them to display something new? I read something on the forums here about it (and have it bookmarked) but I did not understand it... an example would be for potionlist.
The easiest way to gag and replace a line in Lua is to make the trigger call a function in a script file, not send to scripting. Triggers supply Lua functions with an extra argument that holds the styles applied to the matched line, so you can also redraw the line with all the original colours in place if you wanted to.
For the specific task of manipulating potionlist output, the general approach is: gag all vial lines, collect data from each line into a table, display whatever data you want. But there are different ways of doing that, so it's really a subject of a separate discussion.
Simimi2006-10-23 03:40:41
QUOTE
Besides, the only reason to store afflictions in Mushclient variables is to ensure that they persist between sessions, since that's about the only advantage these variables have over internal Lua ones - the latter are discarded every time you close the client. But if you wanted to persist afflictions, you could just as well use the serialize.lua module supplied with Mushclient 3.80 and later.
So your saying that the way above on that link is not an efficient way for doing a Lusternia healing system? And I should use internal Lua ones?
Bye internal Lua ones do you mean just putting the Variables in the variables boxes, and using GetVariable and SetVariable in the triggers and such sent to Lua script?
Any idea on an efficient system for healing?
Thanks for all the help ahead of time!
Love,mimi
Unknown2006-10-23 09:01:34
Yep, I am saying that you shouldn't use Mushclient vars for afflictions. And, no that's not exactly what I mean.
GetVariable/SetVariable actually manipulate Mushclient variables - you don't normally need any special functions to set/get script variable. That method you pointed to is actually a bridge between Lua variables and Mushclient ones. It lets you store values in a Lua table, which automatically stores them in Mushclient variables for you. The problem with it is that it creates a Mushclient variable for each index in a table, which isn't very efficient for afflictions. You could modify it in a way that will prevent it from creating a Mushclient variable for each affliction, but it's just easier to save all your afflictions into a single Mushclient variable when closing the client or reloading the script.
However, that method demonstrates the efficient way of working with afflictions: you just do exactly what you'd do when using that method, minus setting/getting Mushclient variables. Presuming that you call the afflictions table "afflictions", here's how you'd define it in a script:
afflictions = {}
To set an affliction, you just assign true to an index in that table corresponding to the affliction's name:
afflictions.paralysis = true
To reset an affliction, assign false to its index:
afflictions.paralysis = false
To check if the affliction is set or not you can use a simple if check:
if afflictions.paralysis then
  Note("PARALYSED!")
else
  Note("NOT PARALYSED!")
end
You could also iterate over all afflictions you have, checking their status:
for aff,stat in pairs(afflictions) do
  if stat then
    Note("YOU HAVE THE " .. aff .. " AFFLICTION!")
  else
    Note("YOU DON'T HAVE THE " .. aff .. " AFFLICTION!")
  end
end
And if you wanted to save your afflictions table in a Mushclient variable, so you can load it next time you open Mushclient, you could use the already mentioned serialize.lua module:
require "serialize"
SetVariable ("afflictions", serialize.save ("afflictions"))  --> serialize afflictions table Â
That'll save all your afflictions in the Mushclient variable "afflictions". The following line will load them from that variable and into the Lua var afflictions.
loadstring (GetVariable ("afflictions")) ()Â Â --> restore afflictions table
GetVariable/SetVariable actually manipulate Mushclient variables - you don't normally need any special functions to set/get script variable. That method you pointed to is actually a bridge between Lua variables and Mushclient ones. It lets you store values in a Lua table, which automatically stores them in Mushclient variables for you. The problem with it is that it creates a Mushclient variable for each index in a table, which isn't very efficient for afflictions. You could modify it in a way that will prevent it from creating a Mushclient variable for each affliction, but it's just easier to save all your afflictions into a single Mushclient variable when closing the client or reloading the script.
However, that method demonstrates the efficient way of working with afflictions: you just do exactly what you'd do when using that method, minus setting/getting Mushclient variables. Presuming that you call the afflictions table "afflictions", here's how you'd define it in a script:
CODE
afflictions = {}
To set an affliction, you just assign true to an index in that table corresponding to the affliction's name:
CODE
afflictions.paralysis = true
To reset an affliction, assign false to its index:
CODE
afflictions.paralysis = false
To check if the affliction is set or not you can use a simple if check:
CODE
if afflictions.paralysis then
  Note("PARALYSED!")
else
  Note("NOT PARALYSED!")
end
You could also iterate over all afflictions you have, checking their status:
CODE
for aff,stat in pairs(afflictions) do
  if stat then
    Note("YOU HAVE THE " .. aff .. " AFFLICTION!")
  else
    Note("YOU DON'T HAVE THE " .. aff .. " AFFLICTION!")
  end
end
And if you wanted to save your afflictions table in a Mushclient variable, so you can load it next time you open Mushclient, you could use the already mentioned serialize.lua module:
CODE
require "serialize"
SetVariable ("afflictions", serialize.save ("afflictions"))  --> serialize afflictions table Â
That'll save all your afflictions in the Mushclient variable "afflictions". The following line will load them from that variable and into the Lua var afflictions.
CODE
loadstring (GetVariable ("afflictions")) ()Â Â --> restore afflictions table
Simimi2006-10-23 20:45:57
So, your saying, the more I do script side, and the less I do within Mush dependent functions the better/faster/ etc? Since I am just learning, I wanna learn a nice efficient way to do it from the start.
So I would just each trigger to turn the aff.blah that it gies to = true. and the heal to make it = false. Lua .org says it can run through table of thousands of information several times a second and not suffer from speed, so this should be a pretty speed efficient way.
So, if I make my aff curing to be all var.blah =true or var.blah =false, how would I divy up prority, or check to see if i have this and cure it first before this, and could I have it "invisably" make a diag check, without using the diag function (and wasting balance?) or if not, could i have it lcoak the diag from me and just handle what it finds invisably?
Thanka again!
Love-mimi
EDIT: So I would have something like this in my script...
And then when I had a trigger for the affliction, it would set it to true... like..
    ^Why must everything be so hard to figure out?.\\$
        afflictions.paralysis = true
And then, for the script to get the hint to heal it... I would have something like this further down (or maybe with the paralysis affliction so it would be easier to edit later?) in the script..
Is that on the right track at least?
So I would just each trigger to turn the aff.blah that it gies to = true. and the heal to make it = false. Lua .org says it can run through table of thousands of information several times a second and not suffer from speed, so this should be a pretty speed efficient way.
So, if I make my aff curing to be all var.blah =true or var.blah =false, how would I divy up prority, or check to see if i have this and cure it first before this, and could I have it "invisably" make a diag check, without using the diag function (and wasting balance?) or if not, could i have it lcoak the diag from me and just handle what it finds invisably?
Thanka again!
Love-mimi
EDIT: So I would have something like this in my script...
CODE
afflictions = {}
    = "focus body"
    = "drink phlegmatic"
    = "outr pennyroyal; eat pennyroyal"
    = "focus body"
    = "drink phlegmatic"
    = "outr pennyroyal; eat pennyroyal"
And then when I had a trigger for the affliction, it would set it to true... like..
CODE
    ^Why must everything be so hard to figure out?.\\$
And then, for the script to get the hint to heal it... I would have something like this further down (or maybe with the paralysis affliction so it would be easier to edit later?) in the script..
CODE
if afflictions.paralysis then
    send "outr pennyroyal; eat pennyroyal"
    send "outr pennyroyal; eat pennyroyal"
Is that on the right track at least?