[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  What does this mean?

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: What does this mean?
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please).
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Pages: 1 2  3  

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Tue 29 Jan 2008 07:46 AM (UTC)  quote  ]

Amended on Tue 29 Jan 2008 07:47 AM (UTC) by Nick Gammon

Message
As documented here:

http://www.gammon.com.au/scripts/function.php?name=Send

You can use multiple arguments to Send and they are concatentated together without a space between then so you might want to take that into account.

However the concatenation operator in Lua is .. so you could have written:


Send ("decay" .. targ)


Note the brackets, and again note that no space will be supplied. So, if targ was "fish", it would send "decayfish" without a space.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Katherina   (19 posts)  [Biography] bio
Date Tue 29 Jan 2008 07:26 AM (UTC)  quote  ]
Message
Hi,
I'm sorry to be a bother again but I've been looking for an example for a couple of hours now of how to send with a temp variable and haven't found anything. It's 3:30am and I have to get to bed.
What I am wanting to do is this. This is the vbscript

Send "decay" & targ

where targ is the local variable

I would guess it is probably Send ("decay", targ)
but I want to be sure. I'm changing a lot of code and it's difficult to debug so I want to make sure I do it right the first time.

[Go to top] top

Posted by Katherina   (19 posts)  [Biography] bio
Date Mon 28 Jan 2008 11:00 PM (UTC)  quote  ]
Message
Awesome thank you both.
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Mon 28 Jan 2008 09:31 PM (UTC)  quote  ]
Message
You can get a bit fancier by making a table with a metatable which means you can have even less typing, along these lines:


aff = {}

setmetatable (aff, 
   {
   __index = function (t, name) 
              return GetVariable (name) == "1"
             end
   }
   )

if not aff.stun and
   not aff.sleeping and
   not aff.frozen and
   not aff.dead and
   aff.fear and
   not aff.aeon and
   not aff.illusion then
      Send "Compose"
end -- if



Notice now we have not needed to quote words like "stun".

You may want to read up on Lua table handling to see what is happening here, but basically we have an empty table called "aff" with a metatable on it that is called if a key (like "stun") is not found in the table. The metatable handler then does a GetVariable to return the appropriate result.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Mon 28 Jan 2008 09:22 PM (UTC)  quote  ]

Amended on Mon 28 Jan 2008 09:23 PM (UTC) by Nick Gammon

Message
True, you can make it more Lua-like, although initially I wanted it to look fairly much like VB to make it easier to make the transition. Here is something you could do ...

Instead of something like this, which does a lot of GetVariable:


if GetVariable ("stun") == "0" and
   GetVariable ("sleeping") == "0" and
   GetVariable ("frozen") == "0" and
   GetVariable ("dead") == "0" and
   GetVariable ("fear") == "1" and
   GetVariable ("aeon") == "0" and
   GetVariable ("illusion") == "0" then
      Send "Compose"
end -- if


You can write a helper function that gets the variable, and compares it to "1" (being "true" I presume). The function returns true if the variable is equal to "1" and false otherwise. Thus it could look shorter, like this:


function aff (which)
  return GetVariable (which) == "1"
end -- function aff

if not aff ("stun") and
   not aff ("sleeping") and
   not aff ("frozen") and
   not aff ("dead") and
   aff ("fear") and
   not aff ("aeon") and
   not aff ("illusion") then
      Send "Compose"
end -- if


I put "not" in front of the test if I wanted to be testing for false (that is, zero).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Shaun Biggs   USA  (644 posts)  [Biography] bio
Date Mon 28 Jan 2008 05:48 PM (UTC)  quote  ]
Message
As useful as that conversion method would be for most people, I would only suggest using that to get started with Lua scripting. As you learn Lua, you can take advantage of many "tricks" Lua has within it, as well as taking advantage of the wonderful interface with MUSHclient (mostly due to not having to go through WSH).

When I first started using Lua, I went through and converted all of my VBscript and JScript plugins to Lua line by line. They worked alright, but once I actually learned what I was doing, I was able to completely rewrite all these files from scratch to be more elegant and efficient. It would be the same converting from Lua to VBscript or any other language. Each one has its own unique strong points.

The site that helped me out the most with learning Lua, and the one I still visit most frequently when I have questions, is on the Lua user wiki. This "tutorial" is not really a tutorial per se, but it does explain most of the functionality of Lua quite well.
http://lua-users.org/wiki/TutorialDirectory

It is much easier to fight for one's ideals than to live up to them.
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Mon 28 Jan 2008 08:50 AM (UTC)  quote  ]
Message
Wordpad will certainly do some of the replacements, but some of the more sophisticated ones require something like the Global Replace. For example, the table lookup of lower-case function names to the correctly-capitalized one can be done in one pass in MUSHclient, but would require you to handle each one individually in Wordpad.

Also stuff like changing:

SetVariable "something", "something"

to

SetVariable ("something", "something")

is easier using the method I suggested because it is taking the somethings in the middle and putting brackets around them.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Katherina   (19 posts)  [Biography] bio
Date Mon 28 Jan 2008 08:04 AM (UTC)  quote  ]
Message
Thank you so much for the time you have put into this. I really do appreciate it.

I've been going through and just pulling the code into word pad, doing replace all and double checking to make sure it's right. Won't that do the same thing?

I'm new to coding in any sort of mud client. I've used Mushclient for years but the other muds I played didn't allow triggers or scripts so never had to use it before. Lua is also completely new to me. I at least had some background with VB. Though it does look nearly the same and I understand the concepts.

Again thank you
Katherina
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Mon 28 Jan 2008 06:22 AM (UTC)  quote  ]
Message
What I mean by automating the process is ...

The Search menu -> Global Replace function in the internal notepad basically uses Lua string.gsub function to do its replacements. So you could do this:


  • Use the function GetAliasList to get a list of all the aliases.

  • For each alias, see if it uses "send to script"

  • If it uses "send to script" get a copy of the script (using GetAliasOption).

  • Run through the script doing each of the changes I mentioned, by using string.gsub. You may need a few other changes (eg. changing VB comments to Lua comments).

  • Put the corrected script back (SetAliasOption)

  • Move onto the next one


Ditto for triggers and timers.

I would certainly work on a copy of my world file, in case it doesn't work perfectly the first time.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Mon 28 Jan 2008 05:40 AM (UTC)  quote  ]

Amended on Mon 28 Jan 2008 05:51 AM (UTC) by Nick Gammon

Message
As for converting that script to Lua, this is what I did:


  1. Copied and pasted the whole thing into one of MUSHclient's notepad windows.

  2. I fixed the capitalization of function names, which Lua requires to be correct, by using the Search menu -> Global Replace (Ctrl+Shift+G), as described in the forum post "How to fix capitalization of function names in scripts":

    http://www.gammon.com.au/forum/?id=6211

    That is:

    
    
    Find Pattern: [%a%d]+
    Replacement: f
    Call function: checked
    Script:
    
    t1 = utils.functionlist ()
    t2 = {}
    
    -- keys are lower-case functions, values are original functions
    
    table.foreach (t1, function (k, v) t2 [string.lower (v)] = v end )
    
    function f (str)
      return t2 [string.lower (str)] or str
    end -- function f
    


    This changed things like world.getvariable to world.GetVariable

  3. I fixed up "if" statements by doing a global replace of "end if" to "end -- if"

  4. The word "world." is a bit redundant, so I changed "world." to nothing. So in other words:

    
    world.Execute "sh"
    


    becomes:

    
    Execute "sh"
    


  5. As Onoitsu2 pointed out, generally speaking Lua function calls have to be in brackets. In particular you were doing a lot of SetVariable without the brackets. So I used the Search menu -> Global Replace to do another big cleanup:

    
    Find Pattern: SetVariable%s*(.+)
    Replacement: SetVariable (%1)
    Call function: NOT checked
    


    This changes, for example:

    
    SetVariable "truelock", "1"
    


    to:

    
    SetVariable ("truelock", "1")
    


  6. To define local variables Lua uses "local" rather than "dim" so I changed:

    
    dim curhp
    dim curmp
    


    to

    
    local curhp
    local curmp
    


  7. Lua uses == to compare for equality, not =, so another fixup using Search menu -> Global Replace was required:

    
    Find Pattern: GetVariable%s*%(%s*(.-)%s*%)%s*=%s*(%d+)
    Replacement: GetVariable (%1) == "%2"
    Call function: NOT checked
    


    After running this lines like this:

    
    if world.GetVariable ("erebound")=0 and world.getvariable ("hasshield")=0 then
    


    changed to:

    
    if GetVariable ("erebound") == "0" and GetVariable ("hasshield") == "0" then
    


    Note also I quoted the number you are comparing to, as Lua considers "0" and 0 to be different. One is a string and one is a number.

  8. I wanted to make the long "if" statements a bit easier to read, so another Search menu -> Global Replace was used to break the long if statements after the "and", like this:

    
    Find Pattern:  and 
    Replacement:  and\n   
    Call function: NOT checked
    Escape sequences: checked
    


    The find pattern is actually: (space)and(space)
    The replace pattern is actually: (space)and\n(space)(space)(space)

    I mention that because the spaces are hard to see.

    This adds a line break after each "and".

  9. For neatness I also added a blank line after each if:

    
    Find Pattern: end %-%- if
    Replacement:  end -- if\n   
    Call function: NOT checked
    Escape sequences: checked
    


  10. I also wanted to indent the inside of an "if" like this:

    
    Find Pattern: ^Execute 
    Replacement:        Execute  
    Call function: NOT checked
    


    (That is 6 spaces before "Execute" in the replacement box).

    Ditto for the words "SetVariable" and "Send".


A couple of manual cleanups of spacing, and this is the finished result:


if GetVariable ("erebound") == "0" and
   GetVariable ("hasshield") == "0" then
      Execute "ds"
end -- if

if GetVariable ("erebound") == "1" and
   GetVariable ("hasshield") == "1" then
      Execute "rs"
end -- if

if GetVariable ("erebound") == "1" and
   GetVariable ("hasshield") == "0" then
      Execute "rs"
end -- if

if GetVariable ("erebound") == "0" and
   GetVariable ("hasshield") == "1" then
      Execute "rs"
end -- if


SetVariable ("health", "%1")
SetVariable ("mana", "%2")

local curhp
local curmp

curhp=%1
curmp=%2

if curhp < 2800 and
   GetVariable ("moss") == "1" and
   GetVariable ("dead") == "0" and
   GetVariable ("stun") == "0" and
   GetVariable ("sleeping") == "0" and
   GetVariable ("anorexia") == "0" then
      Execute "emo"
      SetVariable ("moss", "0")
end -- if

if curhp < 3300 and
   GetVariable ("elixir") == "1" and
   GetVariable ("dead") == "0" and
   GetVariable ("stun") == "0" and
   GetVariable ("sleeping") == "0" and
   GetVariable ("belonephobia") == "0" and
   GetVariable ("addiction") == "0" then
      Execute "sh"
      SetVariable ("elixir", "0")
end -- if

if curmp < 2500 and
   curhp > 2900 and
   GetVariable ("elixir") == "1" and
   GetVariable ("dead") == "0" and
   GetVariable ("stun") == "0" and
   GetVariable ("sleeping") == "0" and
   GetVariable ("belonephobia") == "0" and
   GetVariable ("addiction") == "0" then
      Execute "sm"
      SetVariable ("elixir", "0")
end -- if

if GetVariable ("illusion") == "1" then
      Execute "resettemps"
end -- if

Execute "setaff"

if GetVariable ("indifference") == "1" and
   GetVariable ("salve") == "1" and
   GetVariable ("dead") == "0" and
   GetVariable ("slickness") == "0" and
   GetVariable ("sleeping") == "0" and
   GetVariable ("stun") == "0" and
   GetVariable ("aeon") == "0" and
   GetVariable ("illusion") == "0" then
      Send "press oculi"
      SetVariable ("salve", "0")
end -- if

if GetVariable ("stupidity") == "1" and
   GetVariable ("dead") == "0" and
   GetVariable ("illusion") == "0" and
   GetVariable ("herb") == "1" and
   GetVariable ("sleeping") == "0" and
   GetVariable ("belonephobia") == "0" and
   GetVariable ("aeon") == "0" and
   GetVariable ("indifference") == "0" and
   GetVariable ("stun") == "0" then
      Send "outc 2 liver slice"
      Send "eat liver slice"
      Send "inc liver slice"
end -- if

if GetVariable ("paralysis") == "1" and
   GetVariable ("dead") == "0" and
   GetVariable ("illusion") == "0" and
   GetVariable ("stupidity") == "0" and
   GetVariable ("herb") == "1" and
   GetVariable ("sleeping") == "0" and
   GetVariable ("belonephobia") == "0" and
   GetVariable ("aeon") == "0" and
   GetVariable ("indifference") == "0" and
   GetVariable ("stun") == "0" then
      Send "outc lung slice"
      Send "eat lung slice"
      SetVariable ("herb", "0")
end -- if

if GetVariable ("limp_veins") == "1" and
   GetVariable ("dead") == "0" and
   GetVariable ("balance") == "1" and
   GetVariable ("aeon") == "0" then
      Send "Fitness"
      SetVariable ("balance", "0")
      SetVariable ("fitness", "1")
end -- if

if GetVariable ("slickness") == "1" and
   GetVariable ("stun") == "0" and
   GetVariable ("dead") == "0" and
   GetVariable ("limp_veins") == "0" and
   GetVariable ("sleeping") == "0" and
   GetVariable ("illusion") == "0" then
      Execute "ia"
end -- if

if GetVariable ("belonephobia") == "1" and
   GetVariable ("salve") == "1" and
   GetVariable ("dead") == "0" and
   GetVariable ("slickness") == "0" and
   GetVariable ("sleeping") == "0" and
   GetVariable ("stun") == "0" and
   GetVariable ("aeon") == "0" and
   GetVariable ("illusion") == "0" then
      Send "press oculi on torso"
      SetVariable ("salve", "0")
end -- if

if GetVariable ("fsleep") == "1" and
   GetVariable ("illusion") == "0" and
   GetVariable ("sleeping") == "1" and
   GetVariable ("aeon") == "0" then
      Execute "wake"
else
if GetVariable ("insomnia") == "0" and
   GetVariable ("fsleep") == "0" and
   GetVariable ("balance") == "1" and
   GetVariable ("equilibrium") == "1" and
   GetVariable ("sleeping") == "0" and
   GetVariable ("fighting") == "1" then
      Send "insomnia"
end -- if

end -- if

if GetVariable ("limp_veins") == "1" and
   GetVariable ("slickness") == "1" and
   GetVariable ("belonephobia") == "1" and
   GetVariable ("paralysis") == "1" and
   GetVariable ("dead") == "0" and
   GetVariable ("stun") == "0" and
   GetVariable ("sleeping") == "0" and
   GetVariable ("aeon") == "0" and
   GetVariable ("illusion") == "0" and
   GetVariable ("balance") == "1" then
      Send "fitness"
      Execute "ia"
else
if GetVariable ("limp_veins") == "1" and
   GetVariable ("slickness") == "1" and
   GetVariable ("belonephobia") == "1" and
   GetVariable ("paralysis") == "1" and
   GetVariable ("confusion") == "1" and
   GetVariable ("frozen") == "1" then
      SetVariable ("truelock", "1")
end -- if

end -- if

if GetVariable ("broken_larm") == "1" and
   GetVariable ("broken_rarm") == "1" and
   GetVariable ("stun") == "0" and
   GetVariable ("illusion") == "0" and
   GetVariable ("dead") == "0" and
   GetVariable ("sleeping") == "0" and
   GetVariable ("aeon") == "0" and
   GetVariable ("equilibrium") == "1" then
      Execute "restore"
end -- if


if GetVariable ("stun") == "0" and
   GetVariable ("illusion") == "0" and
   GetVariable ("dead") == "0" and
   GetVariable ("herb") == "1" and
   GetVariable ("sleeping") == "0" and
   GetVariable ("belonephobia") == "0" and
   GetVariable ("aeon") == "0" and
   GetVariable ("indifference") == "0" then
      SetVariable ("ccslice", "1")
else
      SetVariable ("ccslice", "0")
end -- if

if GetVariable ("salve") == "1" and
   GetVariable ("dead") == "0" and
   GetVariable ("slickness") == "0" and
   GetVariable ("sleeping") == "0" and
   GetVariable ("stun") == "0" and
   GetVariable ("aeon") == "0" and
   GetVariable ("illusion") == "0" then
      SetVariable ("ccpoultice", "1")
else
      SetVariable ("ccpoultice", "0")
end -- if

if GetVariable ("stun") == "0" and
   GetVariable ("dead") == "0" and
   GetVariable ("moss") == "1" and
   GetVariable ("sleeping") == "0" and
   GetVariable ("anorexia") == "0" and
   GetVariable ("aeon") == "0" and
   GetVariable ("illusion") == "0" then
      SetVariable ("ccmoss", "1")
else
      SetVariable ("ccmoss", "0")
end -- if

if GetVariable ("stun") == "0" and
   GetVariable ("dead") == "0" and
   GetVariable ("limp_veins") == "0" and
   GetVariable ("sleeping") == "0" and
   GetVariable ("illusion") == "0" then
      SetVariable ("ccsyringe", "1")
else
      SetVariable ("ccsyringe", "0")
end -- if

if GetVariable ("freedom") == "0" and
   GetVariable ("dead") == "0" and
   GetVariable ("stun") == "0" and
   GetVariable ("writhe") == "0" and
   GetVariable ("sleeping") == "0" and
   GetVariable ("illusion") == "0" then
      Execute "CureWrithe"
end -- if

if GetVariable ("possessed") == "1" and
   GetVariable ("stun") == "0" and
   GetVariable ("frozen") == "0" and
   GetVariable ("dead") == "0" and
   GetVariable ("balance") == "1" and
   GetVariable ("sleeping") == "0" and
   GetVariable ("aeon") == "0" and
   GetVariable ("illusion") == "0" then
      Send "lose soulmaster"
end -- if

if GetVariable ("stun") == "0" and
   GetVariable ("sleeping") == "0" and
   GetVariable ("frozen") == "0" and
   GetVariable ("dead") == "0" and
   GetVariable ("fear") == "1" and
   GetVariable ("aeon") == "0" and
   GetVariable ("illusion") == "0" then
      Send "Compose"
end -- if

if GetVariable ("prone") == "1" and
   GetVariable ("stun") == "0" and
   GetVariable ("dead") == "0" and
   GetVariable ("sleeping") == "0" and
   GetVariable ("aeon") == "0" and
   GetVariable ("balance") == "1" and
   GetVariable ("broken_lleg") == "0" and
   GetVariable ("broken_rleg") == "0" and
   GetVariable ("paralysis") == "0" and
   GetVariable ("freedom") == "1" and
   GetVariable ("illusion") == "0" then
      Send "stand"
end -- if

if GetVariable ("freedom") == "1" and
   GetVariable ("dead") == "0" and
   GetVariable ("stun") == "0" and
   GetVariable ("writhe") == "0" and
   GetVariable ("sleeping") == "0" and
   GetVariable ("aeon") == "0" and
   GetVariable ("illusion") == "0" then
      Execute "CureAll"
end -- if


I hope that gives the general flavour of the "before" and "after". If you have hundreds of similar aliases you could write a script that effectively automated those steps. If you only have a dozen it shouldn't take too long to do them by hand. You could copy and paste them all into one notepad file (separated by hyphens or something) and do each step on the lot as a batch.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Mon 28 Jan 2008 05:04 AM (UTC)  quote  ]
Message
Actually, the code I posted does work, try it and you will see. As a special case Lua allows a single string literal to appear with the brackets. Thus you can do this:


world.Note "hi there"


or


world.Note ("hi there")


I left the brackets out because it was closer to the VB syntax.

However if you want multiple things, or variables, you must use the brackets, eg.


world.Note ("two plus two = ", 2 + 2)


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Onoitsu2   USA  (246 posts)  [Biography] bio
Date Mon 28 Jan 2008 04:15 AM (UTC)  quote  ]
Message
Ummm, Nick, the Lua conversion you posted was wrong, only slightly...

world.Note "hi there"

Should be...

world.Note("hi there")

I know it is a minor slip, but still for someone learning about Lua, they need all the finer details :)

-Onoitsu2
[Go to top] top

Posted by Katherina   (19 posts)  [Biography] bio
Date Mon 28 Jan 2008 02:36 AM (UTC)  quote  ]
Message
if world.GetVariable ("stun")=0 and world.GetVariable ("illusion")=0 and world.GetVariable ("dead")=0 and world.GetVariable ("herb")=1 and world.GetVariable ("sleeping")=0 and world.GetVariable ("belonephobia")=0 and world.GetVariable ("aeon")=0 and world.GetVariable ("indifference")=0 then
world.SetVariable "ccslice", "1"
else
world.SetVariable "ccslice", "0"
end if
if world.GetVariable ("salve")=1 and world.GetVariable ("dead")=0 and world.GetVariable ("slickness")=0 and world.GetVariable ("sleeping")=0 and world.GetVariable ("stun")=0 and world.GetVariable ("aeon")=0 and world.GetVariable ("illusion")=0 then
world.SetVariable "ccpoultice", "1"
else
world.SetVariable "ccpoultice", "0"
end if
if world.GetVariable ("stun")=0 and world.GetVariable ("dead")=0 and world.GetVariable ("moss")=1 and world.GetVariable ("sleeping")=0 and world.GetVariable ("anorexia")=0 and world.GetVariable ("aeon")=0 and world.GetVariable ("illusion")=0 then
world.SetVariable "ccmoss", "1"
else
world.SetVariable "ccmoss", "0"
end if
if world.GetVariable ("stun")=0 and world.GetVariable ("dead")=0 and world.GetVariable ("limp_veins")=0 and world.GetVariable ("sleeping")=0 and world.GetVariable ("illusion")=0 then
world.SetVariable "ccsyringe", "1"
else
world.SetVariable "ccsyringe", "0"
end if
if world.GetVariable ("freedom")=0 and world.GetVariable ("dead")=0 and world.GetVariable ("stun")=0 and world.GetVariable ("writhe")=0 and world.GetVariable ("sleeping")=0 and world.GetVariable ("illusion")=0 then
world.Execute "CureWrithe"
end if
if world.GetVariable ("possessed")=1 and world.GetVariable ("stun")=0 and world.GetVariable ("frozen")=0 and world.GetVariable ("dead")=0 and world.GetVariable ("balance")=1 and world.GetVariable ("sleeping")=0 and world.GetVariable ("aeon")=0 and world.GetVariable ("illusion")=0 then
world.Send "lose soulmaster"
end if
if world.GetVariable ("stun")=0 and world.GetVariable ("sleeping")=0 and world.GetVariable ("frozen")=0 and world.GetVariable ("dead")=0 and world.GetVariable ("fear")=1 and world.GetVariable ("aeon")=0 and world.GetVariable ("illusion")=0 then
world.Send "Compose"
end if
if world.GetVariable ("prone")=1 and world.GetVariable ("stun")=0 and world.GetVariable ("dead")=0 and world.GetVariable ("sleeping")=0 and world.GetVariable ("aeon")=0 and world.GetVariable ("balance")=1 and world.GetVariable ("broken_lleg")=0 and world.GetVariable ("broken_rleg")=0 and world.GetVariable ("paralysis")=0 and world.GetVariable ("freedom")=1 and world.GetVariable ("illusion")=0 then
world.Send "stand"
end if
if world.GetVariable ("freedom")=1 and world.GetVariable ("dead")=0 and world.GetVariable ("stun")=0 and world.GetVariable ("writhe")=0 and world.GetVariable ("sleeping")=0 and world.GetVariable ("aeon")=0 and world.GetVariable ("illusion")=0 then
world.Execute "CureAll"
end if
[Go to top] top

Posted by Katherina   (19 posts)  [Biography] bio
Date Mon 28 Jan 2008 02:36 AM (UTC)  quote  ]
Message
world.SetVariable "health", "%1"
world.SetVariable "mana", "%2"
dim curhp
dim curmp
curhp=%1
curmp=%2
if curhp < 2800 and world.GetVariable ("moss")=1 and world.GetVariable ("dead")=0 and world.GetVariable ("stun")=0 and world.GetVariable ("sleeping")=0 and world.GetVariable ("anorexia")=0 then
world.Execute "emo"
world.SetVariable "moss", "0"
end if
if curhp < 3300 and world.GetVariable ("elixir")=1 and world.GetVariable ("dead")=0 and world.GetVariable ("stun")=0 and world.GetVariable ("sleeping")=0 and world.GetVariable ("belonephobia")=0 and world.GetVariable ("addiction")=0 then
world.Execute "sh"
world.SetVariable "elixir", "0"
end if
if curmp < 2500 and curhp > 2900 and world.GetVariable ("elixir")=1 and world.GetVariable ("dead")=0 and world.GetVariable ("stun")=0 and world.GetVariable ("sleeping")=0 and world.GetVariable ("belonephobia")=0 and world.GetVariable ("addiction")=0 then
world.Execute "sm"
world.SetVariable "elixir", "0"
end if
if world.GetVariable ("illusion")=1 then
world.Execute "resettemps"
end if
world.Execute "setaff"
if world.GetVariable ("indifference")=1 and world.GetVariable ("salve")=1 and world.GetVariable ("dead")=0 and world.GetVariable ("slickness")=0 and world.GetVariable ("sleeping")=0 and world.GetVariable ("stun")=0 and world.GetVariable ("aeon")=0 and world.GetVariable ("illusion")=0 then
world.Send "press oculi"
world.SetVariable "salve", "0"
end if
if world.GetVariable ("stupidity")=1 and world.GetVariable ("dead")=0 and world.GetVariable ("illusion")=0 and world.GetVariable ("herb")=1 and world.GetVariable ("sleeping")=0 and world.GetVariable ("belonephobia")=0 and world.GetVariable ("aeon")=0 and world.GetVariable ("indifference")=0 and world.GetVariable ("stun")=0 then
world.Send "outc 2 liver slice"
world.Send "eat liver slice"
world.Send "inc liver slice"
end if
if world.GetVariable ("paralysis")=1 and world.GetVariable ("dead")=0 and world.GetVariable ("illusion")=0 and world.GetVariable ("stupidity")=0 and world.GetVariable ("herb")=1 and world.GetVariable ("sleeping")=0 and world.GetVariable ("belonephobia")=0 and world.GetVariable ("aeon")=0 and world.GetVariable ("indifference")=0 and world.GetVariable ("stun")=0 then
world.Send "outc lung slice"
world.Send "eat lung slice"
world.SetVariable "herb", "0"
end if
if world.GetVariable ("limp_veins")=1 and world.GetVariable ("dead")=0 and world.GetVariable ("balance")=1 and world.GetVariable ("aeon")=0 then
world.Send "Fitness"
world.SetVariable "balance", "0"
world.SetVariable "fitness", "1"
end if
if world.GetVariable ("slickness")=1 and world.GetVariable ("stun")=0 and world.GetVariable ("dead")=0 and world.GetVariable ("limp_veins")=0 and world.GetVariable ("sleeping")=0 and world.GetVariable ("illusion")=0 then
world.Execute "ia"
end if
if world.GetVariable ("belonephobia")=1 and world.GetVariable ("salve")=1 and world.GetVariable ("dead")=0 and world.GetVariable ("slickness")=0 and world.GetVariable ("sleeping")=0 and world.GetVariable ("stun")=0 and world.GetVariable ("aeon")=0 and world.GetVariable ("illusion")=0 then
world.Send "press oculi on torso"
setvariable "salve", "0"
end if
if world.GetVariable ("fsleep")=1 and world.GetVariable ("illusion")=0 and world.GetVariable ("sleeping")=1 and world.GetVariable ("aeon")=0 then
world.Execute "wake"
else
if world.GetVariable ("insomnia")=0 and getvariable ("fsleep")=0 and getvariable ("balance")=1 and getvariable ("equilibrium")=1 and getvariable ("sleeping")=0 and getvariable ("fighting")=1 then
world.Send "insomnia"
end if
end if
if getvariable ("limp_veins")=1 and getvariable ("slickness")=1 and getvariable ("belonephobia")=1 and getvariable ("paralysis")=1 and world.GetVariable ("dead")=0 and world.GetVariable ("stun")=0 and world.GetVariable ("sleeping")=0 and world.GetVariable ("aeon")=0 and world.GetVariable ("illusion")=0 and world.GetVariable ("balance")=1 then
world.Send "fitness"
world.Execute "ia"
else
if getvariable ("limp_veins")=1 and getvariable ("slickness")=1 and getvariable ("belonephobia")=1 and getvariable ("paralysis")=1 and getvariable ("confusion")=1 and getvariable ("frozen")=1 then
world.SetVariable "truelock", "1"
end if
end if
if world.GetVariable ("broken_larm")=1 and world.GetVariable ("broken_rarm")=1 and world.GetVariable ("stun")=0 and world.GetVariable ("illusion")=0 and world.GetVariable ("dead")=0 and world.GetVariable ("sleeping")=0 and world.GetVariable ("aeon")=0 and world.GetVariable ("equilibrium")=1 then
world.Execute "restore"
end if
to be cont...
[Go to top] top

Posted by Katherina   (19 posts)  [Biography] bio
Date Mon 28 Jan 2008 02:33 AM (UTC)  quote  ]
Message
Thank you I do appreciate the help. I play on Aetolia and the combat system is very complex, everyone has a 'system' for combat so I have to have one to keep up. Most do not use mushclient though and the ones who do that I have met aren't overly inclined to help.

I haven't done any real scripts, I have a background in programming but I graduated college as a Computer programmer 10 years ago, I'm just a little outdated. My strongest language is C/C++. It's been slowly coming back but the logic is still there.

I'll past the alias first, it's a simple one because the others are fairly large. The prompt which is similar to a "main" function I will post right after as the last time I was over the character limit to post.
I also do all the coding through the gui.

Alias:
CanAttack

if world.GetVariable ("erebound")=0 and world.getvariable ("hasshield")=0 then
world.Execute "ds"
end if
if world.getvariable ("erebound")=1 and world.getvariable ("hasshield")=1 then
world.Execute "rs"
end if
if world.getvariable ("erebound")=1 and world.getvariable ("hasshield")=0 then
world.Execute "rs"
end if
if world.getvariable ("erebound")=0 and world.getvariable ("hasshield")=1 then
world.Execute "rs"
end if
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


11,549 views.

This is page 1, subject is 3 pages long: 1 2  3  [Next page]

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]