[ian-reeds-games] Re: getting skill/item/effect/point objects, given their unique IDs or IndexedName

  • From: "Victorious" <dtvictorious@xxxxxxxxx>
  • To: <ian-reeds-games@xxxxxxxxxxxxx>
  • Date: Fri, 13 Mar 2015 10:40:39 +0800

Hi Craig,

The all flags thing requires you to use the object corresponding to the effect 
you want info to be looked up for I thought. For instance, if my 
remove_effects was placed on a unit effect or tile effect, I can get that 
information because the effect object is passed into the effect event 
functions.. So I'm able to see what effects users specified in their 
remove_effects line using the get script flags function. I then split the 
information into arrays of strings containing effect names. However, I am not 
sure how to use the string name itself to get that information for that 
effect.

-----Original Message-----
From: ian-reeds-games-bounce@xxxxxxxxxxxxx 
[mailto:ian-reeds-games-bounce@xxxxxxxxxxxxx] On Behalf Of Craig Brett 
(Redacted sender "craigbrett17@xxxxxxx" for DMARC)
Sent: Friday, March 13, 2015 3:39 AM
To: ian-reeds-games@xxxxxxxxxxxxx
Subject: [ian-reeds-games] Re: getting skill/item/effect/point objects, given 
their unique IDs or IndexedName

Hi Victorious,

To be honest I'm a little confused as to what's actually going on here.
So your flag takes in a comma-separated list of effects to apply, right?
And you then want to see which are tile and which are unit ones.

So effect.AllFlags.get('tile') returns null all the time? How strange.
Do any of the AllFlags things work for you?

Craig

On 10/03/2015 11:19, Victorious wrote:
> Hi Craig,
>
> Take a look at the following:
>
> // checks for the existence of a specified flag on an effect. If
> present, the line is then split into lists of effects, which is then
> passed to the ApplyMultipleEffects function function
> vicApplyMultipleEffectsOnFlag(effect, unit, targetTile, flag) { if
> (flag == null) return; var line = effect.ScriptFlags.get(flag); if
> (line == null) return; var effects = line.split(", "); // string array
> of effect names var isTileEffect =
> vicDictionaryHasKey(effect.AllFlags, "tile"); // needed because the
> AllFlags.get(flag) don't return anything but null even if that flag
> exists
>
> if (isTileEffect)
> {
> // assume that effects to be applied are also tile effects
> vicApplyMultipleTileEffects(effects, targetTile) } else {
> vicApplyMultipleEffects(effects, unit); } }
>
> Is there a better way of me doing this? The problem is that the
> information in the flags are strings of effect names, and I am not
> sure how to look up their flags set without the corresponding object.
>
> Victorious
> -----Original Message-----
> From: ian-reeds-games-bounce@xxxxxxxxxxxxx
> [mailto:ian-reeds-games-bounce@xxxxxxxxxxxxx] On Behalf Of Craig Brett
> (Redacted sender "craigbrett17@xxxxxxx" for DMARC)
> Sent: Tuesday, March 10, 2015 3:01 PM
> To: ian-reeds-games@xxxxxxxxxxxxx
> Subject: [ian-reeds-games] Re: getting skill/item/effect/point
> objects, given their unique IDs or IndexedName
>
> Hi Victorious,
>
> In short, no. There's no global "findSomethingWithThisName" type
> function, mostly because 2 or more things can have the same name.
> Often skills and effects will share a name, for example.
>
> Though you do have the ability to check off any given object's
> IndexedName against whatever value you have in your effect's script
> flags, etc. Is that the sort of thing you're after?
>
> Craig
>
> On 09/03/2015 19:15, Victorious wrote:
>> Hi Craig/Ian,
>>
>> Is there currently a way to get a effect/skill/item/point object if
>> you have its unique name? For example, I'd like to improve a
>> effects_on_apply flag on effects. I need to assume that the effect
>> type (unit or tile effect) that the script is used on, and the
>> effects specified match as otherwise bad things will happen. If I had
>> that ability, I could define custom behaviour - if the effect that
>> script is on is a tile effect and some effects in the
>> effects_on_apply string are actually unit effects, the map creater
>> probably intended them to apply
> to everything in the tile.
>> Victorious

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Other related posts: