Author Topic: Couple of commands  (Read 5293 times)

0 Members and 1 Guest are viewing this topic.

Offline CervezaTopic starter

  • Hacksimus Maximus
  • Scripthack
  • *
  • Posts: 5857
  • Activity:
    0%
  • Reputation Power: 80
  • Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!
  • Gender: Male
  • So... Hows that Hopey-Changey thing working out?
  • Respect: +403
  • Referrals: 11
    • View Profile
Couple of commands
« on: October 20, 2010, 04:18:58 AM »
0
I'm wondering how scripts speak to each other. In EUOx I use this to make my script wait till looting is completed:
Code: [Select]
    repeat
      namespace copy TM_loot_in_progress from global TM_loot
    until !TM_loot_in_progress <> #TRUE

How does that translate?

Actually, how would this entire sub translate?

Code: [Select]
sub Check_Status
if #targCurs = 1 || #lLiftedKind = 1
  return #TRUE
namespace copy TM_HEAL from global TM_HEAL
if !TM_HEAL = #TRUE
  return #TRUE
wait 10
namespace copy TM_loot_in_progress from global TM_loot
if !TM_loot_in_progress = #TRUE
  return #TRUE
return #FALSE
XXXXXXXXXX________________________________________] 20%
I've forgotten more about this game then most people will ever know.
Thank you for controlling your children. Their manners reflect your love for them.
Give a man a fish and you feed him for a day. Don't teach a man to fish, and you feed yourself. He's a grown man. Fishing's not that hard.

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13301
  • Activity:
    0%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Couple of commands
« Reply #1 on: October 20, 2010, 08:04:32 AM »
0
That's exactly why I created my namespace interface routines.  I'll post an example today, but with my namespace routines, you can make that code look hauntingly similar to your OEUO code.
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13301
  • Activity:
    0%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Couple of commands
« Reply #2 on: October 20, 2010, 08:19:09 AM »
0
These values are also what I'm using in my new OEUO scripts.  Sample code for both of your questions:

Code: [Select]
dofile("tm_namespaces9.lua")
ns = TM_NS:New() -- setup local and global namespaces
-- ..
-- ..
-- ..
function Check_Status()
  if UO.TargCurs == true or UO.LLiftedKind == true then
    return true
  end
  if ns:ReadAbs("global","TM_HEAL","TM_HEAL") == true then
    return true
  end
  if ns:ReadAbs("global","TM_loot","TM_loot_in_progress") == true then
    return true
  end
  return false
end

-- Inline looter busy test
--
-- repeat
-- until ns:ReadAbs("global","TM_loot","TM_loot_in_progress") ~= true
--

I created the "ReadAbs" and "WriteAbs" routines because there's lots of times when you want to directly read from an addressed namespace, so it's a pain in the butt to copy the value from that namespace and then address it using the current namespace.  Again, that just came from lots of experience using Cheffes namespace stuff to see what works and what's cumbersome.
« Last Edit: October 20, 2010, 08:20:43 AM by TrailMyx »
Please read the ScriptUO site RULES
Come play RIFT with me!

Tags: