Author Topic: Scrolling "neon" lettering script  (Read 401 times)

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Scrolling "neon" lettering script
« on: March 15, 2012, 02:09:43 pm »


                 I'd started the script monday morning, plugging away a bit at it each morning when I get home from work, but there's an oddity in how it's displaying the text that I can't really figure out.
  It might be overlap from one letter to the next, or it might be getting the objects messed up somehow, but it only seems to do it when changing letters.  A series of identical letters seems to work error free.

  Since it's hard to explain, I uploaded a video showing some examples of what it's doing here:
 
  A link to the erf with the scripts and listener creature plus placeable is here for anyone that wants a look at the code.  
 It could be code related, or it might be something caused by the bean vfx used to make the letters up.  I'll have time this week-end to fix it up if someone could get an idea what's causing the letter jumble to begin with.
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Scrolling "neon" lettering script
« Reply #1 on: March 15, 2012, 06:59:01 pm »


               First question: are the invisible beam targets being spawned in or are they permanent in the area? Spawned in beam targets can fail to display properly, especially when used en masse. I learned this the hard way a few years back, when playing with inc_draw, trying to make a large 'forcecage' to contain a reaction.

If they're permanent, I would try adding a debug output at the point of application of beam effect, with the origin and target object tag/identifier being displayed ( I assume you're gridding by tag or by variable).

F
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Scrolling "neon" lettering script
« Reply #2 on: March 15, 2012, 08:35:34 pm »


               Also in line with what Funky is suggesting, if you are spawning in the beam targets, you could replace the invisible targets with something very visible just to physically see if there is something strange going on with the targets.
I messed around with this awhile back. Spelling out AFK over players heads.
               
               

               


                     Modifié par GhostOfGod, 15 mars 2012 - 08:38 .
                     
                  


            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Scrolling "neon" lettering script
« Reply #3 on: March 16, 2012, 12:37:03 pm »


               The beam targets are spawned in dynamically when the listener creature first "hears" the character speak.  The targets are tagged by letter position (1-10) and grid position (1-9) so that they're all unique.

I'll try out a few different styles of displaying the letters to try and narrow it down this week-end.  Scrolling letters just saved me having to write a string parsing script, but if that's inconsistent I may have to make it flash a full word at a time.
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Scrolling "neon" lettering script
« Reply #4 on: March 16, 2012, 03:40:23 pm »


                 I did up a cage of sorts, using the spawned invisible placeable method, with effects on them, and there doesn't seem to be any inconsistencies in how they work with that method.
  I don't think the placeables are the issue, anyways.  It seems like spawning them, even if applying an effect immediately, works fine.

 
Here's the script if anyone wants to see that test.  I triggered it off an on activated property .  Likely I could make it a bit more efficient still if I tried, there's a bit of possibly unneeded  redundant code.

// (3/16/2012) Failed Bard
// Test Glowing Lights Cage.

float fDuration = 60.0;
float fDistance = 5.0;

location FB_GetFrontLocation (location lTarget, float fDistance, float fFacing = 0.0);

void main()
{
location lTarget = GetItemActivatedTargetLocation();
object   oArea   = GetAreaFromLocation   (lTarget);
float    fFacing = GetFacingFromLocation (lTarget);

location lPeak, lTop, lBottom;
object   oPeak, oFirstTop, oTop, oLastTop, oFirstBottom, oBottom, oLastBottom;
vector   vPos;
int i;

vPos = GetPositionFromLocation (lTarget);
vPos.z += 5.0;
lPeak = Location (oArea, vPos, fFacing);
DestroyObject (oPeak = CreateObject (OBJECT_TYPE_PLACEABLE, "neon_lights", lPeak, FALSE), fDuration + 1.0);

lBottom = FB_GetFrontLocation (lTarget, fDistance, fFacing);
DestroyObject (oBottom = CreateObject (OBJECT_TYPE_PLACEABLE, "neon_lights", lBottom, FALSE), fDuration + 1.0);
oFirstBottom = oBottom; oLastBottom = oBottom;

vPos = GetPositionFromLocation (lBottom);
vPos.z += 3.0;
lTop = Location (oArea, vPos, fFacing);
DestroyObject (oTop = CreateObject (OBJECT_TYPE_PLACEABLE, "neon_lights", lTop, FALSE), fDuration + 1.0);
oFirstTop = oTop; oLastTop = oTop;

ApplyEffectToObject (DURATION_TYPE_TEMPORARY, EffectBeam (VFX_BEAM_SILENT_LIGHTNING, oPeak, BODY_NODE_CHEST), oTop,   fDuration);
ApplyEffectToObject (DURATION_TYPE_TEMPORARY, EffectBeam (VFX_BEAM_SILENT_LIGHTNING, oTop, BODY_NODE_CHEST), oBottom, fDuration);


while (i++ < 11)
   {
    fFacing += 30.0;

    lBottom = FB_GetFrontLocation (lTarget, fDistance, fFacing);
    DestroyObject (oBottom = CreateObject (OBJECT_TYPE_PLACEABLE, "neon_lights", lBottom, FALSE), fDuration + 1.0);

    vPos = GetPositionFromLocation (lBottom);
    vPos.z += 3.0;

    lTop = Location (oArea, vPos, fFacing);
    DestroyObject (oTop = CreateObject (OBJECT_TYPE_PLACEABLE, "neon_lights", lTop, FALSE), fDuration + 1.0);

    ApplyEffectToObject (DURATION_TYPE_TEMPORARY, EffectBeam (VFX_BEAM_SILENT_LIGHTNING, oPeak, BODY_NODE_CHEST), oTop, fDuration);
    ApplyEffectToObject (DURATION_TYPE_TEMPORARY, EffectBeam (VFX_BEAM_SILENT_LIGHTNING, oTop, BODY_NODE_CHEST), oBottom, fDuration);
    ApplyEffectToObject (DURATION_TYPE_TEMPORARY, EffectBeam (VFX_BEAM_SILENT_LIGHTNING, oLastTop, BODY_NODE_CHEST), oTop, fDuration);
    ApplyEffectToObject (DURATION_TYPE_TEMPORARY, EffectBeam (VFX_BEAM_SILENT_LIGHTNING, oLastBottom, BODY_NODE_CHEST), oBottom, fDuration);

    oLastBottom = oBottom;
    oLastTop = oTop;
   }
ApplyEffectToObject (DURATION_TYPE_TEMPORARY, EffectBeam (VFX_BEAM_SILENT_LIGHTNING, oTop, BODY_NODE_CHEST), oFirstTop, fDuration);
ApplyEffectToObject (DURATION_TYPE_TEMPORARY, EffectBeam (VFX_BEAM_SILENT_LIGHTNING, oBottom, BODY_NODE_CHEST), oFirstBottom, fDuration);
}

location FB_GetFrontLocation (location lTarget, float fDistance, float fFacing = 0.0)
{
float ModX = cos (fFacing) * fDistance;
float ModY = sin (fFacing) * fDistance;

vector vPos  = GetPositionFromLocation (lTarget);
vPos.x += ModX;
vPos.y += ModY;

lTarget = Location (GetAreaFromLocation (lTarget), vPos, fFacing);
return lTarget;
}
               
               

               
            

Legacy_wyldhunt1

  • Sr. Member
  • ****
  • Posts: 443
  • Karma: +0/-0
Scrolling "neon" lettering script
« Reply #5 on: March 16, 2012, 05:25:24 pm »


               Not sure if this could have something to do with it, but I had a peculiarity with some code a while back that replaced items in inventory.
The problem was that the destroyed objects did not destroy themselves until after the script ended.
Because of that, new objects would stack with objects that I had already destroyed. As soon as the script ended, the entire stack would go away and I'd be left with nothing.

With that in mind, it appears as though commands such as:
DestroyObject (oTop = CreateObject (OBJECT_TYPE_PLACEABLE, "neon_lights", lTop, FALSE), fDuration + 1.0);
May be tagging oTop to be destroyed at the end of the script... Or maybe at the end of the loop.
Since CreateObject is nested inside of DestroyObject, it probably isn't getting created until the object is destroyed.

In order to get around it, I had to delay an excecutescript and have the new script create the new items based on variables I set. Delaying a custom function in the same script wasn't enough. The DestroyObject command just refused to destroy anything until the end of the script.

Odd behavior.

I'd try pulling the CreateObject stuff out to their own lines so that they can be defined and created immediately, and then let the old ones be destroyed whenever they get around to it.

Cool script, btw!
               
               

               


                     Modifié par wyldhunt1, 16 mars 2012 - 05:31 .
                     
                  


            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Scrolling "neon" lettering script
« Reply #6 on: March 17, 2012, 12:51:46 am »


               

Failed.Bard wrote...

  I did up a cage of sorts, using the spawned invisible placeable method, with effects on them, and there doesn't seem to be any inconsistencies in how they work with that method.
  I don't think the placeables are the issue, anyways.  It seems like spawning them, even if applying an effect immediately, works fine.

Yup, the places are the issue. Sorry, I know it's not what you were hoping to hear. If you find a fix, I'd love to hear it, but we've dealt with this issue a number of times (inluding things like double-application of beams - even that doesn't work reliably), so I wouldn't get your hopes up.

F
               
               

               


                     Modifié par FunkySwerve, 17 mars 2012 - 12:55 .
                     
                  


            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Scrolling "neon" lettering script
« Reply #7 on: March 17, 2012, 02:08:21 am »


                 I just did a bit more testing, with both the original scrolling system, and with flashing words, and it's definately not the placeables in my script that were the issue.

  Originally, I had the scrolling "move" every 0.25 seconds, and the beam duration at 0.24.  Switching it to 0.25 and 0.2 duration was enough to fix it.

  The best guess I have on that, is that there must be something in how beams are handled that makes existing beams, or ones about to be removed, able to affect the destination of the next beam emitted from the same object/node.

  The updated erf is at the old link (and  here for convenience).  I need to make a few more changes to it still, including adding in the numbers and what punctuation I can make work (apostrophes for sure) under that display system.
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Scrolling "neon" lettering script
« Reply #8 on: March 17, 2012, 04:45:25 pm »


                I uploaded a demo clip of the newest version of the script here.

 There are occasional flickers that look like they might be graphic artifacts that might be associated with the beam vfx at creation, but no stray beams anymore.
  The end of the clip also shows the force cage, and a two part pentagram linked with the cage for a summoning.

  I think I might make up an include of my own next for drawing some generic shapes with.  I have all the location finding scripts written out already anyways, so it's largely just basic math used creatively (a square being 4 points at 45 degrees outwards from the center rather than forward and back, then to either side, for example).
               
               

               
            

Legacy_Mad.Hatter

  • Full Member
  • ***
  • Posts: 156
  • Karma: +0/-0
Scrolling "neon" lettering script
« Reply #9 on: March 17, 2012, 05:25:44 pm »


               Very cool! There is so much potential with a system like this.