[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]  New to MUSHclient

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

New to MUSHclient

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


Pages: 1  2  3  4  5 

Posted by Tsunami   USA  (204 posts)  [Biography] bio
Date Reply #60 on Tue 06 Feb 2007 05:09 AM (UTC)  quote  ]
Message
The assumption is that temp_afflicted is created somewhere else in the script, and that this is appropriately checked. You could equally set it equal to {} instead of nil.
[Go to top] top

Posted by Caelan   Vanuatu  (12 posts)  [Biography] bio
Date Reply #61 on Tue 06 Feb 2007 11:51 AM (UTC)  quote  ]
Message
So would this work since it depends on the IF?

function temp_toreal ()
lifevision = GetVariable("lifevision")
-- see if it picked up lifevision

 if (lifevision == true) then
  temp_aff = {}
  return
 end -- if

 elseif (lifevision == false)
  for k in pairs (temp_aff) do
   afflicted(k)
  end -- for
 end -- if
end -- function


temp_aff is the table. temp_afflicted would be a function similar to the previous 'afflicted' one to assign the afflictions to the temp_aff table. If lifevision is true, I want all afflictions (would be 2 or 3 tops) cleared out of the temp_aff table.
[Go to top] top

Posted by Tsunami   USA  (204 posts)  [Biography] bio
Date Reply #62 on Tue 06 Feb 2007 03:41 PM (UTC)  quote  ]
Message
The idea is right, but there are a couple syntax problems.


if (lifevision == true) then
  temp_aff = {}
  return
 end


the 'end' right there closes the if statement. This means that you can't continue it with the elseif. Because of the return statement, you can eliminate the elseif altogether. If the script execution gets to that point, it is guarenteed lifevision is false; if not, it would have returned from the function.
[Go to top] top

Posted by Nick Gammon   Australia  (18,769 posts)  [Biography] bio   Forum Administrator
Date Reply #63 on Tue 06 Feb 2007 06:42 PM (UTC)  quote  ]
Message
Quote:

lifevision = GetVariable("lifevision")
-- see if it picked up lifevision

if (lifevision == true) then


You haven't addressed here my concerns expressed earlier about variable types. You are using "true" here which is a boolean type, but GetVariable returns a string type. These are two different data types, and thus the expression " (lifevision == true)" will always be false. That is, it will never execute the code inside that 'if".

I suggest you play around with Lua a bit to get a feel for the syntax, perhaps a simple program in the Immediate window to print a list of numbers and multiply them by 2, something like that. Then you will feel more comfortable tackling more complex problems.

Quote:

The assumption is that temp_afflicted is created somewhere else in the script, and that this is appropriately checked.


It is my experience that it is usually assumptions that bring programs undone.

The code below should be syntactically correct, whether it works or not depends on what the variables are used for elsewhere:



function temp_toreal ()

-- see if it picked up lifevision

 if GetVariable ("lifevision") == "1" then
  temp_aff = {}
  return
 end -- if

  for k in pairs (temp_aff) do
   afflicted (k)
  end -- for

end -- function

- Nick Gammon

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

Posted by Caelan   Vanuatu  (12 posts)  [Biography] bio
Date Reply #64 on Fri 16 Feb 2007 01:18 PM (UTC)  quote  ]

Amended on Fri 16 Feb 2007 01:24 PM (UTC) by Caelan

Message
I got it to work. Thanks for the help.

I use tempafflicted to work the same as your 'afflicted' table function from before... then the other function is like this...


function tempafflicted (what)
  temp_aff 
Template:what Please help us by showing:
  • A copy of the trigger, alias or timer you were using (see Copying XML)
  • The error message, if any, that you got
= true -- note the affliction end -- function afflicted function temp_toreal () -- see if it picked up lifevision if GetVariable ("lifevision") == "1" then temp_aff = {} return end -- if for k in pairs (temp_aff) do afflicted (k) end -- for temp_aff = {} SetVariable ("lifevision", 0) end -- function


Anytime it picks up '** Illusion **' it just clears any afflictions so the '** Illusion **' could have come before or after the msgs (but before the prompt as it always does).

Thanks again.

Edit : I got the idea here -
http://www.gammon.com.au/forum/bbshowpost.php?id=6670
but I think this is way easier (at least for me) when combined with the info at the beginning of this thread. I was able to set up a healing setup that goes off all the seperate balances (tree/focus/herb/salve/smoke (no balance on smoking though but for aeon it would be helpful)) and doesn't trip up so long as the person has lifevision. Now I just need to further illusion-proof for times when lifevision doesn't pick up the Illusion. THANKS A TON!
[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.


19,763 views.

This is page 5, subject is 5 pages long:  [Previous page]  1  2  3  4  5 

[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]