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 ➜ Auto-Sipper Help

Auto-Sipper Help

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


Posted by Duma   USA  (9 posts)  Bio
Date Mon 02 Apr 2007 09:30 PM (UTC)
Message
Hi, I'm new to MUSH and I'm having troubles with an auto-sipper I'm using for Aetolia. It's supposed to check my health and if I have elixer balance then I will drink a health potion. Also if I have moss balance and I'm in the arena I will eat some irid moss.

Here's the trigger I use to call my Auto-Sipper Sub

<triggers>
  <trigger
   enabled="y"
   expand_variables="y"
   group="Auto_Sipper"
   match="H:* M:* E:*% W:*% B:*% [eb]"
   name="Auto_Sipper"
   script="AutoSipper"
   send_to="12"
   sequence="100"
  >
  <send>call AutoSipper</send>
  </trigger>
</triggers>


Here's my script -

Sub AutoSipper(theName, theOutput, theWildcards)
	world.note "Trigger Fired"
	dim maxHealth
	dim curHealth
	dim arena
	dim elixerBalance
	dim mossBalance
	maxHealth = world.GetVariable ("MaxHealth")
	curHealth = theWildcards(1)
	arena = world.GetVariable ("arena")
	elixerBalance = world.getVariable ("elixerBalance")
	mossBalance = world.getVariable ("mossBalance")
	if curHealth / maxHealth <= .5 and elixerBalance = 1 then
		world.send "drink health"
		if arena = 1 and mossBalance = 1 then
			world.send "outc moss"
			world.send "eat moss"
			world.setVariable "mossBalance", "0"
		end if
	end if
	drinkElixer = 0
	world.SetVarible "elixerBalance", "0"
End Sub 


I got the following error message -

Error number: -2146827838
Event: Execution of line 1 column 1
Description: Wrong number of arguments or invalid property assignment: 'AutoSipper'

Called by: Immediate execution

I don't quite understand the arguments part of it. Anyways, can anyone help?

Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Mon 02 Apr 2007 09:38 PM (UTC)

Amended on Mon 02 Apr 2007 09:39 PM (UTC) by Nick Gammon

Message
You are effectively calling it twice.

You already have 'script="AutoSipper"' which means it will call the AutoSipper script. You don't also need "call AutoSipper".

Delete the "call AutoSipper" and change from "send to script" to "send to world", like this:


<triggers>
  <trigger
   enabled="y"
   expand_variables="y"
   group="Auto_Sipper"
   match="H:* M:* E:*% W:*% B:*% [eb]"
   name="Auto_Sipper"
   script="AutoSipper"
   sequence="100"
  >
  </trigger>
</triggers>



- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Duma   USA  (9 posts)  Bio
Date Reply #2 on Mon 02 Apr 2007 09:45 PM (UTC)
Message
Alright, I did that now I got this message -

Error number: -2146827850
Event:        Execution of line 34 column 2
Description:  Object doesn't support this property or method: 'world.SetVarible'
Called by:    Function/Sub: AutoSipper called by trigger
Reason: processing trigger "Auto_Sipper"


What did I do wrong this time?
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #3 on Mon 02 Apr 2007 10:00 PM (UTC)
Message
It is a good idea to get used to using the built-in help. Things must be spelt precisely in scripting languages or they won't work.

http://www.gammon.com.au/scripts/doc.php?function=SetVariable

The word is SetVariable, not SetVarible.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Duma   USA  (9 posts)  Bio
Date Reply #4 on Mon 02 Apr 2007 10:05 PM (UTC)
Message
Ah, a spelling error, thanks for pointing it out. I'm not getting any more errors. I just have to test it with a real fight now.
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.


15,224 views.

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.