Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ New to MUSHclient

New to MUSHclient

It is now over 60 days since the last post. This thread is closed.     Refresh page


Pages: 1  2  3  4  5 

Posted by Tsunami   USA  (204 posts)  Bio
Date Reply #60 on Tue 06 Feb 2007 05:09 AM (UTC)
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.
Top

Posted by Caelan   Vanuatu  (12 posts)  Bio
Date Reply #61 on Tue 06 Feb 2007 11:51 AM (UTC)
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.
Top

Posted by Tsunami   USA  (204 posts)  Bio
Date Reply #62 on Tue 06 Feb 2007 03:41 PM (UTC)
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.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #63 on Tue 06 Feb 2007 06:42 PM (UTC)
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
Top

Posted by Caelan   Vanuatu  (12 posts)  Bio
Date Reply #64 on Fri 16 Feb 2007 01:18 PM (UTC)

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!
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.


163,299 views.

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

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.