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

Author Topic: [Resolved] Inventory Stuff  (Read 8504 times)

TGSRofar

  • General Accounts
  • *
  • Posts: 153
    • View Profile
Re: Inventory Stuff
« Reply #15 on: Aug 30, 11, 09:03:41 PM »

That makes sense.  I never did figure out how to use the AddCollectionHeader method because I also was thinking that was supposed to be in a script somewhere and was clueless where it would go.  I never even considered it was something that can be executed from a command. But it makes perfect sense now.

So, I have been doing my headers completely different...the only way I could figure out how to do it.  I suppose I can do it the "correct" way now.

Just for reference, here is how I am currently doing it.  This is in the SpecOracleClassMethod.

Code: [Select]
method ListCollectionHeaders() as List of String
  //
  // Returns a list of header names for the Spec Selector Editor to display
  //
  headers as List of String
  if me.collectionHeaders.length = 0
    // use default of specKey and prototype Name
    add back "SpecKey" to headers
    add back "ItemType" to headers
    me.collectionHeaderMapFieldNameToDisplayName[ "itemtype" ] = "Type"
    add back "displayName" to headers
    me.collectionHeaderMapFieldNameToDisplayName[ "displayname" ] = "Name"
  else
    headers = me.collectionHeaders
   
    hasSpecKey as Boolean
    foreach h in me.collectionHeaders
      if tolower( h ) = "speckey"
        hasSpecKey = true
      .
    .
    if not hasSpecKey
      add front "SpecKey" to headers
    .
  .
  return headers
.
Logged
Ron Farrell
Lead Programmer
Triad Game Studios

TheRabid

  • General Accounts
  • *
  • Posts: 41
    • View Profile
Re: Inventory Stuff
« Reply #16 on: Mar 04, 12, 05:39:07 PM »

Hey sorry to bump such an old topic, but I have been following it closely to create a Spec Oracle (for inventory items.)
I have managed to get all the way to getting the Spec Oracle added to the Hot Spot menu and prompt an editor, but when I click the Add button, it just hangs on "Requesting New Spec." I was curious if anyone might know where I should start looking to root out the problem.

The error I get in the chat box is "The Pending spec was told it was ready but was unable to locate prototype."
« Last Edit: Mar 04, 12, 06:06:37 PM by TheRabid »
Logged

XCalPro

  • General Accounts
  • *
  • Posts: 105
  • 3D Artist & HSL Coder
    • View Profile
    • Excalibur Productions
Re: Inventory Stuff
« Reply #17 on: Mar 04, 12, 11:46:08 PM »

Did you create a prototype for your Spec Oracle on the server?
Logged
Tony Oliveira aka XCalPro
HeroEngine Projects: Traveller 6 Online - www.traveller6.com/forum/
Portfolio: www.xcalpro.com/art

TheRabid

  • General Accounts
  • *
  • Posts: 41
    • View Profile
Re: Inventory Stuff
« Reply #18 on: Mar 05, 12, 12:35:17 AM »

Yes I did, and also it creates Spec prototypes, but just doesn't manifest the add dialog.

Code: [Select]
02:58:14: State:  [ORGANIZERMSG PORG PORG ADD ID="9223372055923832015" PARENT="0" NAME="InventoryItemSpec25" DESCRIPTION="Default"]   0 ms
02:58:16: State:  [GOTCHATMESSAGE [hsl_error] 4611686018427637930,6: [Clean Test] SCRIPT ERROR: In function ScriptError: The Pending spec was told it was ready but was unable to locate prototype.
03/05/2012 07:58:26 UTC
Call trace:
  Script PendingSpecPrototypeClassMethods line 70 me[9223372055923832013]
  Script PendingSpecPrototypeClassMethods line 93 me[9223372055923832013]
starting method/function PENDINGSPECPROTOTYPETIMER_TICK
starting me[id=9223372055923832013 class=PendingSpecPrototype]]   0 ms
02:58:16: State:  [SERVERSCRIPTERROR 4611686018427637930,6: [Clean Test] SCRIPT ERROR: In function ScriptError: The Pending spec was told it was ready but was unable to locate prototype.
03/05/2012 07:58:26 UTC
Call trace:
  Script PendingSpecPrototypeClassMethods line 70 me[9223372055923832013]
  Script PendingSpecPrototypeClassMethods line 93 me[9223372055923832013]
starting method/function PENDINGSPECPROTOTYPETIMER_TICK
starting me[id=9223372055923832013 class=PendingSpecPrototype]]   0 ms
02:58:21: State:  [HSE2 SERVER_DECL PROTOS
« Last Edit: Mar 05, 12, 02:05:36 AM by TheRabid »
Logged

TheRabid

  • General Accounts
  • *
  • Posts: 41
    • View Profile
Re: Inventory Stuff
« Reply #19 on: Mar 05, 12, 05:08:33 PM »

I have been trouble shooting all morning.

Checked all of my classes to make sure they had the proper scripts, I feel like I am missing something though.

Logged

mixxit

  • General Accounts
  • *
  • Posts: 25
    • View Profile
Re: Inventory Stuff
« Reply #20 on: Mar 05, 12, 05:42:06 PM »

yeah i didnt do that step as it doesnt specify where that script goes, ie spec class, oracle class, or utils class methods i did try to add it to spec class and got compile errors so didnt save it.. since the last thing that step by step was telling you to create the client side class methods and adjust things there..

i did load journey up yet again to search for that var oracle and did not find it in the itemspec class nor itemspecoracle server or client. if its just a blank script i tried that also client side and got compile errors on bout every line..

I had this same problem as the guide had no destination for the information to go to

Having someone execute a command to update it also seems a bit clunky, shouldn't there be a place this goes so the column headers are always shown correctly?
Logged

mixxit

  • General Accounts
  • *
  • Posts: 25
    • View Profile
Re: Inventory Stuff
« Reply #21 on: Mar 05, 12, 05:56:09 PM »

That makes sense.  I never did figure out how to use the AddCollectionHeader method because I also was thinking that was supposed to be in a script somewhere and was clueless where it would go.  I never even considered it was something that can be executed from a command. But it makes perfect sense now.

So, I have been doing my headers completely different...the only way I could figure out how to do it.  I suppose I can do it the "correct" way now.

Just for reference, here is how I am currently doing it.  This is in the SpecOracleClassMethod.

Code: [Select]
method ListCollectionHeaders() as List of String
  //
  // Returns a list of header names for the Spec Selector Editor to display
  //
  headers as List of String
  if me.collectionHeaders.length = 0
    // use default of specKey and prototype Name
    add back "SpecKey" to headers
    add back "ItemType" to headers
    me.collectionHeaderMapFieldNameToDisplayName[ "itemtype" ] = "Type"
    add back "displayName" to headers
    me.collectionHeaderMapFieldNameToDisplayName[ "displayname" ] = "Name"
  else
    headers = me.collectionHeaders
   
    hasSpecKey as Boolean
    foreach h in me.collectionHeaders
      if tolower( h ) = "speckey"
        hasSpecKey = true
      .
    .
    if not hasSpecKey
      add front "SpecKey" to headers
    .
  .
  return headers
.

This doesn't seem to change my headers when I add this
Logged

JoshHalls

  • Founding Professional
  • *****
  • Posts: 335
    • View Profile
    • The Repopulation
Re: Inventory Stuff
« Reply #22 on: Mar 05, 12, 06:29:39 PM »

Restart the client and then check to see if the prototype is there, have had to restart sometimes and reenter the prototype and make sure you are putting it in the right location (server).

--josh
Logged
Co-Owner/Programmer - The Repopulation

TheRabid

  • General Accounts
  • *
  • Posts: 41
    • View Profile
Re: Inventory Stuff
« Reply #23 on: Mar 05, 12, 06:41:01 PM »

I just started from scratch and was able to not run in to this problem again on the second go around.

I am glad I started from scratch, as it helped me understand the Spec system and what all those classes do a lot better.
Logged

mixxit

  • General Accounts
  • *
  • Posts: 25
    • View Profile
Re: Inventory Stuff
« Reply #24 on: Mar 05, 12, 08:00:10 PM »

Restart the client and then check to see if the prototype is there, have had to restart sometimes and reenter the prototype and make sure you are putting it in the right location (server).

--josh

That was it! I was putting the header code in the client side


Also then got the issue mentioned above about it stuck 'Loading...', appeared I didn't have itemType so i removed these two line and it's now showing displayName correctly

    add back "ItemType" to headers
    me.collectionHeaderMapFieldNameToDisplayName[ "itemtype" ] = "Type"

Yay!
« Last Edit: Mar 05, 12, 08:07:52 PM by mixxit »
Logged

TheRabid

  • General Accounts
  • *
  • Posts: 41
    • View Profile
Re: Inventory Stuff
« Reply #25 on: Mar 05, 12, 08:10:15 PM »

I added this to my Developer Class Method script

So when I run "/Developer addheader" it adds the header I want (this was one of the first tuts that taught you how to make a /command.)

Code: [Select]
to "addheader"
     var oracle = GetPrototype("ItemSpecOracle")
     where oracle is kindof ItemSpecOracle
     oracle.AddCollectionHeader("Field Name","Field Description",true)
    .   
  .

Logged

Jrome90

  • General Accounts
  • *
  • Posts: 330
    • View Profile
Re: Inventory Stuff
« Reply #26 on: Mar 05, 12, 10:07:38 PM »

To add/change specoracle headers you can use this ;)
Logged

JoshHalls

  • Founding Professional
  • *****
  • Posts: 335
    • View Profile
    • The Repopulation
Re: Inventory Stuff
« Reply #27 on: Mar 05, 12, 10:14:57 PM »

To add/change specoracle headers you can use this ;)

Definitely go with that.  We have a command to do it, but it pretty much does the same thing.
Logged
Co-Owner/Programmer - The Repopulation

XCalPro

  • General Accounts
  • *
  • Posts: 105
  • 3D Artist & HSL Coder
    • View Profile
    • Excalibur Productions
Re: Inventory Stuff
« Reply #28 on: Mar 06, 12, 07:38:58 AM »

I attempted to port over the inventory system used in HJ Ref world a few weeks ago and realized its a major project as there are dozens of class scripts and fields as well as dozens of GUIXMLs to copy over. After about two weeks, I managed to get the inventory window to appear as it should only to realize that in order to assign the inventory to a character, I would also have to port over the CCS and CSS as well. In addition, the inventory system is also tied into many of the other systems like Quest, NPC, and Item Visualization.

I would not recommend trying to port over the inventory system from HJ, but rather build your own from scratch as I have learned the hard way. Starting with a simple inventory and build up from there. One key element that will make creating an inventory system easier will be the addition of the Item System which is not yet available: http://hewiki.heroengine.com/wiki/Item_System
Logged
Tony Oliveira aka XCalPro
HeroEngine Projects: Traveller 6 Online - www.traveller6.com/forum/
Portfolio: www.xcalpro.com/art

TamGarTrinKi

  • General Accounts
  • *
  • Posts: 1
    • View Profile
Re: Inventory Stuff
« Reply #29 on: Mar 07, 12, 08:50:08 PM »

Ah, I see other people have had the "Where does this tutorial's code go?" problem also.

For the moment I refer to this, the Spec Oracle section that was itselfed linked from the step by step guide .

The problem arising from the "Implement a Clientside  Singleton Getter" which, if added to the _SpecOracleUtilsClassMethods (which is what it mentions just before the code, regardless of the script editor suggesting you do not change that file) it throws a bunch of warnings when compiled (only some to do with the strictness of the distribution package of the code added).
This pales in comparison to the "Add your oracle to the (Clientside) HE_GetSpecOracleByClass" part which shows a function that does not exist in the listed file.

BUT...

Is this code actually meant to go in a newly made MYNEWSHINYORACLE_SpecOracleUtilsClassMethods?, because neither page manages to say this is the case. And so far it is throwing far less warnings my way.
Logged
Pages: 1 [2] 3