Page 1 of 1

Error in simple script

Posted: 2004-07-07 21:23:31
by Sauza

Code: Select all

var mocban="banco"
sub selmocban()
   if (mocban=="banco") then
      uo.exec("setreceivingcontainer banco")
      uo.print(">> Loot al Banco <<")
      uo.print(">> Loot al Banco <<")
      mocban="mochila"
   else
      uo.exec("setreceivingcontainer mochila")
      uo.print(">> Loot ala Mochila <<")
      uo.print(">> Loot ala Mochila <<")
      mocban="banco"
   end if
end sub


Banco and mochila are objects
This script must work as a switch, option 1 container banco, option 2 container mochila
Now it only switch one container an not change to another.

Help Me!
Thank you. =)

Posted: 2004-07-08 10:05:40
by Yoko
global variables used through command uo.SetGlobal("name","textvalue") and uo.GetGlobal("name")

Posted: 2004-07-08 21:42:16
by Sauza
Final Script
Thx Yoko :)

Code: Select all

sub selmocban()
   if (uo.GetGlobal("mocban")=="banco") then
      uo.exec("setreceivingcontainer banco")
      uo.print(">> Loot al Banco <<")
      uo.print(">> Loot al Banco <<")
      uo.SetGlobal("mocban","mochila")
   else
   uo.exec("setreceivingcontainer mochila")
      uo.print(">> Loot ala Mochila <<")
      uo.print(">> Loot ala Mochila <<")
      uo.SetGlobal("mocban","banco")
   end if
end sub

Posted: 2004-07-08 22:01:59
by Sauza
This is wrong???

Code: Select all

sub loot()
uo.exec("load loot.sc")
end sub