Help - Search - Members - Calendar
Full Version: Dataset Questions
AC Tools Everything Macro > AC Tool Macros > Macro Development
Al Chemistry
OK I finally broke down and wrote my first macro using Datasets. And After beating my head agsinst the wall for hours on end I finally got it working, but I was wondering if there is any good write-ups out there that Show all Fields and TYPEs that are predefined.

i.e LoadDecalWorldEx TYPE, 24 //For PLayers


Just wondering where to look to find all the types or how to figure out what they are.

Thanks in advance for all your help and suggestions.
Triane
Try these:
[1]Dataset Types
[2]Question on Datasets
[3]DSInventory Item "Types"??
[4]Global Forum Search on "LoadDecal*"

For most of the LoadDecalX commands, and the structure of their related datasets, look in the ACTools help, and/or the ReadMe file.

-Triane
Al Chemistry
OK lets see if I finally am getting somewhere. So basically the best way to find out would be to write a macro like this?

Corret or Not ? Basically am I on the right track?


CODE

SetActiveWindow Asheron's Call

Constants
temp1 = 0
temp2 = 0
temp3 = 0
End

LoadDecalInventory
LoadDecalWorld
LoadDecalMonarch

DataSet InventoryTest
Name = String 100
GUID = Integer
Count = Integer
Value = Integer
Usesleft = Integer
TotalUses = Integer
Type = Integer
Slot = Integer
Container = Integer
End

DataSet WorldTest
Name = String 100
GUID = Integer
Count = Integer
Value = Integer
Usesleft = Integer
TotalUses = Integer
Type = Integer
Slot = Integer
Container = Integer
Distance = Integer
End

Dataset MonarchTest
Name = String 100
GUID = Integer
Type = Integer
Experience = Integer
Online = Integer
Gender = Integer
Race = Integer
Rank = Integer
Loyalty = Integer
Leadership = Integer
ParentGUID = Integer
End

DSCount DSInventory, temp1
DSCount DSWorld, temp2
DSCount DSMonarch, temp3

SendText 7, DsInventory has $temp1 items to Find
SendText 7, DsWorld has $temp2 items to Find
SendText 7, DsMonarch has $temp3 intems to Find


DSFirst DSInventory
Loop $temp1
DSAppend InventoryTest
setconst InventoryTest[Name] = DSInventory[Name]
setconst InventoryTest[GUID] = DSInventory[GUID]
setconst InventoryTest[Count] = DSInventory[Count]
setconst InventoryTest[Value] = DSInventory[Value]
setconst InventoryTest[UsesLeft] = DSInventory[Usesleft]
setconst InventoryTest[TotalUses] = DSInventory[TotalUses]
setconst InventoryTest[Type] = DSInventory[Type]
setconst InventoryTest[Slot] = DSInventory[Slot]
setconst InventoryTest[Container] = DSInventory[Container]
DSNext DSInventory
End
DSEdit InventoryTest
DSPost InventoryTest
DSSave InventoryTest, c:\Inventory.cds


DSFirst DSWorld
Loop $temp2
DSAppend WorldTest
setconst WorldTest[Name] = DSWorld[Name]
setconst WorldTest[GUID] = DSWorld[GUID]
setconst WorldTest[Count] = DSWorld[Count]
setconst WorldTest[Value] = DSWorld[Value]
setconst WorldTest[UsesLeft] = DSWorld[Usesleft]
setconst WorldTest[TotalUses] = DSWorld[TotalUses]
setconst WorldTest[Type] = DSWorld[Type]
setconst WorldTest[Slot] = DSWorld[Slot]
setconst WorldTest[Container] = DSWorld[Container]
setconst WorldTest[Distance] = DSWorld[Distance]
DSNext DSWorld
End
DSEdit WorldTest
DSPost WorldTest
DSSave WorldTest, c:\World.cds


DSFirst DSMonarch
Loop $temp3
DSAppend MonarchTest
setconst MonarchTest[Name] = DSMonarch[Name]
setconst MonarchTest[GUID] = DSMonarch[GUID]
setconst MonarchTest[Type] = DSMonarch[Type]
setconst MonarchTest[Experience] = DSMonarch[Experience]
setconst MonarchTest[Online] = DSMonarch[Online]
setconst MonarchTest[Gender] = DSMonarch[Gender]
setconst MonarchTest[Race] = DSMonarch[Race]
setconst MonarchTest[Rank] = DSMonarch[Rank]
setconst MonarchTest[Loyalty] = DSMonarch[Loyalty]
setconst MonarchTest[Leadership] = DSMonarch[Leadership]
setconst MonarchTest[ParentGUID] = DSMonarch[ParentGUID]
DSNExt DSMonarch
End
DSEdit MonarchTest
DSPost MonarchTest
DSSave MonarchTest, c:\Monarch.cds
Triane
CODE
LoadDecalInventory
LoadDecalWorld
LoadDecalMonarch


These are fine, but I'm not quite sure why you defined the three datasets "WorldTest", "InventoryTest" and "MonarchTest"? Presuming there's a reason outside the scope of this code sample, there are some things to point out:

(1) ACTools automatically predefines specific datasets for you. In this case the ones you're interested in are "DSWorld", "DSInventory" and "DSMonarch". There are others as well, but as you're not referencing them, I won't either. I point this out because, unless there is another specific reason for duplicating the internal datasets, you don't need to do so: you can work straight from the internal sets directly. I'm not saying that there's no reason to duplicate them, there are several good reasons, one of which is discussed at length here but if you're doing it simply for dereferncing the data, it's an unnecessary step.

(2) Calling one of the "LoadDecalX" commands populates the relevant internal dataset with the relevant information, gleaned from Decal. These datasets are NOT updated in real-time. They are ONLY populated when the relevant "LoadDecalX command is called. In this case, all previous data in the set is erased and new data repopulates the set.

(3) You dereference/utilise these datasets exactly the same way as any other dataset you've created, with all the same commands and methodologies.

(4) It looks as though you're manually copying the contents of the internal datasets to a backup dataset, you should look up "DSCopy" in relation to this process.

Taking these things into account, your code sample could be rewritten like so:
CODE
SetActiveWindow Asheron's Call

Constants
 temp1 = 0
 temp2 = 0
 temp3 = 0
End

DataSet InventoryTest
 NotImportant = Integer
End

DataSet WorldTest
 NotImportant = Integer
End

DataSet MonarchTest
 NotImportant = Integer
End

LoadDecalInventory
LoadDecalWorld
LoadDecalMonarch

DSCount DSInventory, temp1
DSCount DSWorld, temp2
DSCount DSMonarch, temp3

SendText 7, DsInventory has $temp1 items to Find
SendText 7, DsWorld has $temp2 items to Find
SendText 7, DsMonarch has $temp3 intems to Find

// Because you are looking to save this data to a file anyway, this process
// actually works BETTER than DSCopy. If you weren't looking to leave a file
// then using "DSCopy" would be more efficient.
DSSave DSInventory, c:\Inventory.cds
DSSave DSWorld, c:\World.cds
DSSave DSMonarch, c:\Monarch.cds

DSLoad InventoryTest, C:\Inventory.cds
DSLoad WorldTest, C:\World.cds
DSLoad MonarchTest, C:\Monarch.cds


That snippet would perform the exact same function as the one you wrote, but (obviously) in a lot fewer lines. Remember: when you load a dataset (via DSLoad or by DSCopying) the target dataset's fields and contents are OVERWRITTEN by that of the source dataset. That's why it doesn't matter how we define the fields of WorldTest, MonarchTest and InventoryTest.

Does that help any?

-Triane
Al Chemistry
I think I can finally see the light now thanks
Triane
No problem! Happy to help biggrin.gif

-Triane
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.