Auto-Sipper Help

Posted by Duma on Mon 02 Apr 2007 09:30 PM — 5 posts, 20,320 views.

USA #0
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?

Australia Forum Administrator #1
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>


Amended on Mon 02 Apr 2007 09:39 PM by Nick Gammon
USA #2
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?
Australia Forum Administrator #3
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.
USA #4
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.