|
hpoonis2010 |
Posted: Mon May 25, 2020 1:49 pm
Massive failures! |
|
hpoonis2010 Adept
Joined: 18 Jun 2019 Posts: 279
|
Posted: Tue Jul 21, 2020 6:11 pm |
I can wrap my head around it now.
I am still having serious issues with TEMP triggers. Some of them create permanent triggers when they fire. SO I end up with a long list of the same trigger.
Here's my code:
Code: |
#LOCAL $local_id
#LOCAL $object // Record var
#LOCAL $local_name // store name of item
#LOCAL $word_count
// Items in list loop
$itemcount=%numitems(@popitemlist)
// Do while there are items in the list
#WHILE ($itemcount>0) {
// Fetch record from popitemlist
$object=@popitemlist.$itemcount
$local_name=$object.name
$itemcount=$itemcount-1
#sh $local_name
$word_count=%numitems($local_name)
#FORALL $local_name {
ID %i
#TEMP {~| Keywords%s: (%w)%s~|} {#ADDITEM @itemlist %1}
}
}
|
What I am trying to achieve is...
I have a trigger that pops the known data for eq items looted from mobs. That becomes a db of eq items. There is a room in the mud that will fully id items. So I head there after a period of time and I want to loop through the items, having them fully identified.
@popitemlist =
mob=sparring warrior|zone=Warrior's Training Camp|room=19960|name="WTC|spiked|mace"
mob=sparring warrior|zone=Warrior's Training Camp|room=19960|name="WTC|padded|leather|shield"
mob=sparring warrior|zone=Warrior's Training Camp|room=19960|name="WTC|regulation|belt"
mob=sparring warrior|zone=Warrior's Training Camp|room=19960|name="pair|of|WTC|padded|leather|boots"
mob=sparring warrior|zone=Warrior's Training Camp|room=19960|name="WTC|fatigue|uniform"
mob=sparring warrior|zone=Warrior's Training Camp|room=19960|name="OFFICIAL|WTC|STUDENT|ID|BADGE"
and then I loop through the name list (EG., pair|of|WTC|padded|leather|boots) running ID on every word. Now I was hoping that I could break the string loop once a successful ID has occurred. In the example 'pair' and 'of' will not be recognised as a valid word to reference the item but WTC is. So it would be nice to not bother checking the rest of the items. I tried a TEMP trigger but all I ended up with were more triggers. Thus, it seems I shall have to make regular triggers.
Now, if you look at the 'popitemlist' data you can see that every one of the items has 'WTC' in it. Thus it would be perfect to use the unique item ID number that eq has in aard. So, my plan for that was to do a basic id first - char id does not give all the info but it does give the unique ID number - and then populate a list that I can then use to do the full ID back at the ID room. The alternative would be to disregard any duplicates and expect the db key to overwrite the previous entry with the same key.
The dilemma is that the TEMP trigger (another) I wanted to use to grab the ID number ... just makes more triggers. |
|
|
|
hpoonis2010 Adept
Joined: 18 Jun 2019 Posts: 279
|
Posted: Tue Jul 21, 2020 7:05 pm |
OK. I added a #WAIT which solved the lag. The although the class now opens and closes at the right time, the trigger still does not fire.
It is baffling! |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4671 Location: Pensacola, FL, USA
|
Posted: Wed Jul 22, 2020 2:55 pm |
Name your #TEMP triggers to prevent having duplicates.
As $localVars only exist inside the {Brackets} they are defined in, you only need to use #LOCAL on $vars that are going to be defined {inside a separate pair of curly brackets} like an #IF or a #LOOP of some sort, for scoping reasons.
Logic error:
// Fetch record from popitemlist
$object=@popitemlist.$itemcount
Given that $itemCount is an integer, unless you have integer keys in @popItemList, this won't return a useful value
I think you want:
%item(@popItemList, $itemCount)
Better still...
Code: |
#FORALL %dbkeys(@popItemList) {
$object=%db(@popItemList, %i)
$name=%db($object, name)
#sh $name
#FORALL $name {
ID %i
#TEMP "keywordGrabber" {Keywords%s: (%w)%s~|} {#ADDITEM @itemlist %1}
#WAIT 1000
}
} |
|
|
_________________ Discord: Shalimarwildcat |
|
|
|
hpoonis2010 Adept
Joined: 18 Jun 2019 Posts: 279
|
Posted: Wed Jul 22, 2020 7:34 pm |
It (itemcount) does render a record as a placeholder key was created with the record when looting.
I will try naming to see if that helps. |
|
|
|
|
|