HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.
Pages: 1 2 [3]

Author Topic: (solved) spec system info?  (Read 5976 times)

Thazager

  • General Accounts
  • *
  • Posts: 1155
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: (solved) spec system info?
« Reply #30 on: Apr 19, 16, 07:06:08 PM »

classes on gui: E_AbilityBar
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1155
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: (solved) spec system info?
« Reply #31 on: Apr 19, 16, 08:09:34 PM »

if you take a look at the commands/functions available through the $specOracleUtils: theres alot there that you can probably make use of.  Pretty good list of tools for specs.

Would this _RequestAllCommonFieldsforSpecOracle() do the same thing as the LoadSpecForSkill() ? or would they just be blank string of field names?

I'm wondering if this would be similar _RequestFieldNamesAndDescriptions() in that it just has empty fields but a description of what the field is, from the DOM.
Logged

ToY-Krun

  • General Accounts
  • *
  • Posts: 677
  • Support Volunteer
    • View Profile
Re: (solved) spec system info?
« Reply #32 on: Apr 19, 16, 10:32:10 PM »

they would be blanks.

can you show me a copy of the LoadSpecForSkill() code?

Lets take a look once more at how its loading the spec.

we know you're code is getting to that point, so lets start there.

Thazager

  • General Accounts
  • *
  • Posts: 1155
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: (solved) spec system info?
« Reply #33 on: Apr 19, 16, 10:59:04 PM »

In E_AbilityBarClassMethods:

class E_AbilityBar has parents ObsListener and GUIPanel

Code: [Select]
function PerformAbility(skillName as String)
   gui as NodeRef of Class E_AbilityBar = FindGuiControlByName(None,"game.E_AbilityBar")
   if gui != None
     key as ID = 1
     gui.LoadSpecForSkill(key)
     println("name "+gui.name+"  "+gui)  // prints gui name & ID #

     foreach c in GetClassesOnNode(gui)
       println("classes on gui "+c)              // prints only E_AbilityBar
     .       
  .
  println("name "+skillName)
  SendCommand("/ability use "+skillName)
.

method LoadSpecForSkill(SpecKey as ID)
  var oracle = $SPECORACLEUTILS._GetSpecOracleByClass("EO_SkillSpecOracle")
  oracle.requestSpecByKey(SpecKey, me)
  println("LoadSpecForSkill  "+SpecKey+"  listener "+me)   // <---  prints 1 & gui ID #
.

// call back method from server
method EventRaised( obs as NodeRef of Class ObsSubject, data as NodeRef )
  spec as NodeRef of Class EO_SkillSpec = data
  println("event data "+data+"  spec "+spec)      // <-- does not print

  if spec != None
     name as String = spec.displayName
     println("EventRaised "+name)
  .
  RemoveAssociation( obs, "obsSubjectToListenerAssoc", me )
.
Logged

ToY-Krun

  • General Accounts
  • *
  • Posts: 677
  • Support Volunteer
    • View Profile
Re: (solved) spec system info?
« Reply #34 on: Apr 20, 16, 12:17:03 AM »

Okay, the only conclusion i can draw is that the oracle is not returning the proper Spec Oracle...

I noticed that the code for the specOracleUtils class on the wiki is not linked...

not sure why, but anyway, have you created a custom SpecOracleUtils class and script on the client side?
http://wiki.anvilofhonor.com/wiki/index.php/Custom_SpecOracleUtils

Make sure of the spelling of the spec oracle class in the code below, replace the name
where you need to.


Here is the code for the script:

Code: [Select]
method GetItemSpecOracle() as NodeRef of Class _ItemSpecOracle
  itemSpecOracle as NodeRef of Class _itemSpecOracle = $SPECORACLEUTILS._GetSpecOracleByClass( "_itemSpecOracle" )
 
  return itemSpecOracle
.

method Get*Ability*SpecOracle() as NodeRef of Class *Ability*SpecOracle
  aso as NodeRef of Class *Ability*SpecOracle = $SPECORACLEUTILS._GetSpecOracleByClass("*Ability*SpecOracle")
  return aso
.


method HE_GetAllSpecOracles( oracles references List of ID ) as Boolean
// This method is called to retrieve all of the oracles of which the spec system should be
//    aware.  The default GUIs and a variety of utility functions depend on your oracle
//    being included in this list
//
  add back me.GetItemSpecOracle() to oracles
  add back me.Get*Ability*SpecOracle() to oracles
  return true
.
method HE_GetSpecOracleByClass( oracleClass as String, specOracle references NodeRef of Class SpecOracle ) as Boolean
 
  Assert( ClassExists( oracleClass ), "Invalid class name provided to GetSpecOracleByClass")
 
  oracles as List of NodeRef of Class SpecOracle = $SPECORACLEUTILS._GetKnownSpecOracles()
 
  oTest as NodeRef
  foreach o in oracles
    otest = o
    when toLower( oracleClass )
      is "*ability*specoracle"
        if otest is kindof *Ability*SpecOracle
          specOracle = otest
          break
        .
      .
      is "itemspecoracle"
        if otest is kindof _itemSpecOracle
          specOracle = otest
          break
        .
      .
    .
  .
  if specOracle <> None
    return true
  .
 
  return false
.

Thazager

  • General Accounts
  • *
  • Posts: 1155
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: (solved) spec system info?
« Reply #35 on: Apr 20, 16, 12:46:21 AM »

There was a script similar in context, and a class that was configured into the F5.
I added the needed functions /  changes.

Thanks, that is what did it. It now shows the Event and name of the spec used.
« Last Edit: Apr 20, 16, 12:52:17 AM by Thazager »
Logged

ToY-Krun

  • General Accounts
  • *
  • Posts: 677
  • Support Volunteer
    • View Profile
Re: (solved) spec system info?
« Reply #36 on: Apr 20, 16, 04:59:08 PM »

ohhh okay, good!

if you have any more probs with it give a shout.

Thazager

  • General Accounts
  • *
  • Posts: 1155
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: (solved) spec system info?
« Reply #37 on: Apr 27, 16, 10:36:32 PM »

After having it work for a while, it recently started giving an error:

ERROR:HeroScript::HeroMachine::ScriptError:GOM::removeAssociation (8210): association not found to remove

skill setup to point at the skill window gui

  var oracle = $SPECORACLEUTILS._GetSpecOracleByClass("EO_SkillSpecOracle")
  oracle.requestSpecByKey(SpecKey, skill)

The error shows up on the EventRaised() at the end:

  RemoveAssociation( obs, "obsSubjectToListenerAssoc", skill )


Any idea what might cause this error?  (After working good for a few days)

Add:
out of curiosity, I commented out that line and the window looks fine, however it constantly loads...?
« Last Edit: Apr 27, 16, 10:45:58 PM by Thazager »
Logged

ToY-Krun

  • General Accounts
  • *
  • Posts: 677
  • Support Volunteer
    • View Profile
Re: (solved) spec system info?
« Reply #38 on: Apr 27, 16, 11:28:08 PM »



Actually you shouldn't need the RemoveAssociation() line as thats a leftover from intial code.
If your class didnt have the class "obsListener" as a parent class, you would call:
AddListener() which creates the association.

Since ObsListener is already on your class, you wouldnt have to remove it.

If RemoveAssociation() is called before the window is destroyed, it would probably pass through okay,
maybe something changed now so that the window doesnt exist when RemoveAssociation() is called?
Once the gui is destroyed the association would be destroyed with it.
Or if the window is hidden only, and RemoveAssociation() is called on it , it would succeed the first time through,
but if called again on the same GUI, the association would have been removed already and so it would error out.

Hard to say exactly but maybe one of those comments will give you an idea where to look.

It should work fine without that line of code.

Quote
out of curiosity, I commented out that line and the window looks fine, however it constantly loads...?

Exactly what do you mean it "constantly loads" ?

Thazager

  • General Accounts
  • *
  • Posts: 1155
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: (solved) spec system info?
« Reply #39 on: Apr 27, 16, 11:43:28 PM »

Played around with it, got it working. It seems to have been an initial value was set differently than expected. (good thing for println() )

Quote
Exactly what do you mean it "constantly loads" ?

Every time I moved the mouse over the skill in the skill window, the println("event") would show from the EventRaised method.
Logged

ToY-Krun

  • General Accounts
  • *
  • Posts: 677
  • Support Volunteer
    • View Profile
Re: (solved) spec system info?
« Reply #40 on: Apr 28, 16, 12:18:30 AM »

Ahh gotcha.  Yeah you should be able to remove that removeassociation() though and be fine.
The initial script used AddListener() to as the gui was created from script only and not from a class that had ObsListener.

Pages: 1 2 [3]