Showing posts with label Scripting. Show all posts
Showing posts with label Scripting. Show all posts

23 October 2014

Hip Hip Array!

I had a script working absolutely fine (by which I mean it worked "mostly fine"), and then I made some changes to it which involved the inclusion of some diagnostics.

And then the Bad Things began.

My script was basically building multiple arrays by collecting data and indexing it non-sequentially.  Instead of assigning data to my_array[ 0 ], followed by my_array[ 1 ], then my_array[ 2 ], I would first collect data for my_array[ 5 ], followed by data for my_array[ 3 ], and so forth.

My diagnostics printed out all of the data collected by the arrays, and that data was incorrect.  "Math," I cursed, and started debugging.  Socks recently supported negative indexes (which means instead of writing my_array[ index - 1 ], I could instead just write my_array[ -1 ] ), and I was convinced that my array index pointer was somehow falling into a negative number.  I added more diagnostics.  The correct answers were being displayed correctly with these new diagnostics, but the data was still wrong within the summarized diagnostics.

Three days of debugging and I found the problem: my script was absolutely fine, but my summary diagnostics were looking at the wrong sets of data types.  Once I corrected that, then all of the data matched.

I am such a chucklehead sometimes.

13 October 2014

Math Is Fun

I've spent the past three days working on some new scripts.  One of the scripts required (ugh) math.  And not just X + Y = Z kind of math, but more like the A² + B² = C² kind of math.  I needed to draw some circles, but I forgot how to do that.  And by "forgot" I really mean "I was never really clear on how to do this in the first place."

So I asked Mr. Google.

Google returned, what turns out to be, a very good site: Math is fun!  The particular section that I needed was help on sines and cosines, and the mathisfun.com site explained these functions very clearly and simply.

Thanks to both mathisfun.com and Google for the help.  My script is behaving just as I had envisioned it behaving -- perhaps a little bit more.  I'm really excited, and look forward to finishing the script.  The hardest part has been done: arranging objects in circles on the screen!

08 October 2014

Undercover Boss(es)

Tonight I tried a soft-open on a new monster type that I had discussed in the past.  While this whole concept is still in its testing phase (and I am aware of several bugs, so I know that this concept is far from being finished).  I was very pleased to see that my new monster template worked as intended.


Thanks to everyone who (unwittingly) participated!

18 August 2013

And Now I Dust My Hands

I have completed my work on my latest script to the point where I feel comfortable checking it in to the script repository.  I began adding one of my "it would be nice – but not mandatory – to include this cool feature" ideas and quickly learned that Socks would not readily support what I wanted to do, and by this point I lack the energy and motivation to crowbar new technologies into this script.  As it stands, the script is "good enough" for now, and that future feature can simmer on the back burner.

Now comes the uncertain part: releasing the script into the wild.

I must say that I am rather pleased with the result.  Maybe one of you may see it in action sometime soon.

15 August 2013

Scripter Humor

I have been reading other scripts with the intent of plagiarizing becoming inspired by other GMs/scripters' works.

Scripters will often add comments within their code as to describe what task/role the section of code performs.  I was interested in how other GMs have handled math problems (like calculating the average size of a mobile), and while researching that subject I was entertained by some amusing one liners.  Or in some cases, multi-liners.

    // Initialize it, cap'n!
   
    //    This is a public file.

    //    Everyone is welcome, nay encouraged,
    //    to use it and add to it.   
   
    // OK, dumkopf. You use it, you lose it.
       
    // All the nifty display poo goes here

    /*
    **    utilities for manipulating the [player]'s store-string
    **    err, I mean the data-string
    **    no, wait, make that the thing-string
    */


And my personal favorite:

    **    **Warning** this code is god-like and perfect.
    **    When we work on it choirs of angels
    **    gather around and sing. Mortals must keep out.
    **    This code is so blindingly beautiful
    **    that your eyes will melt if you look at it.

13 August 2013

The Back-up Back Up Plan

My creative patch for my current script did not work as intended, which means I go to Plan B.  Or am I now on Plan C?

Anyways, work continues on it, although sometimes it is discouraging.  I want to get it done and away from me so that I may work on something else, but then I also want it to work well.

Writing bad code is easy!  It's the good stuff which takes time.

12 August 2013

Timing Is Everything

While putting the finishing touches on my latest script, I came across a wrinkle in which no amount of ironing would smoothen.

The script, like another script I recently completed, is a process which hangs out in the background and watches the goings-on of nearby NPCs.  The function of this script needs to know if the NPC is busy with a player.

I tested my script on my test server, and overall the script is looking sturdy.  It did fumble a little bit on the task of checking the availability of a NPC: the script could not seem to recognize that a player was bumping into a NPC.

As with the combat script, I think this too is a matter of bad timing on my part.  My derpy script is looking blindly for bump flags which may or may not have been set.  I think that I am checking too early in the clock cycle – way before the NPC/player bump has been processed.

So I have rigged a hack-ish solution.  It's not very pretty, but it looks as though it will get the job done.  Maybe.  I will test it and confirm that it works.  Or I will confirm that it does not work.

As the old saying goes, timing is everything.  I seem to have a genius for bad timing.

11 August 2013

Marathon Scripting

I arrived home late this morning from a long day out (arriving home close to 2:00am), so I slept in until 10:30am.  At 10:31am, after brewing a pot of coffee, I was sitting at my computer and there I remained for twelve hours: first restructuring, rewriting, and then refining a new Clan Lord script.

The new script is looking very solid.  I still need to add some back-end commands (like a kill switch: in the event that things go badly, it's always comforting to have a self-destruct button to panic-stab while sobbing uncontrollably).

A couple of more lines of code and this should be ready for testing on the test server – on tomorrow.  Not tonight.  I think I'm done for today.

06 August 2013

Script Reconstruction

I went from polishing a script to dismantling a script to reconstructing a script within the period of three hours.

As I was rereading the code to my current project, I had realized that I was not negative enough in its organization.  In fact, I was not negative at all, and the free-for-all organization which I had structured the script made it difficult for me to understand what it was that I was trying to accomplish.

So the good news is that the new script looks great!  The less-than-great news is that I wrote it out longhand on a piece of scrap paper, which means that there is an entire transcribing process which still needs to happen, and that the transcribing process is highly unlikely to happen before the v819 update goes live.

Perhaps if I employ puppy dog eyes then ServerGM would be willing to transfer the completed (and full tested) script to the live world this weekend.

05 August 2013

Script Polishing

Today was a vacation day for me, so I got to stay home and do fun stuff: I spent my entire day debugging and polishing a new script (and this script is not in any way related to combat).

The script runs a new tool for v819, and I got it to a point where it works well enough, but it works well with vulnerabilities.  Being a rather frightened and slightly paranoid Yappy, I am working to seal off any perceived leaks and problems.  The last thing I want to have is a scripting misfire resulting in the injury of one of our gerbils.

I need to work fast.  The update is less than 48 hours away.  Does anyone know where I can buy some gerbil insurance?

04 August 2013

Did I Tag Yet?

I have learned far more about the internal mechanisms of combat than I had ever had hoped to learn.  Or cared to have learned.

Before pushing the v819 update out to the UpdateGMs, I wanted to get one more script submitted before the deadline.  And as the one who receives and packages the updates, I get to choose the timing of that deadline!

The script is a simple one on paper: monitor the combat of a monster and inform the script when the monster has tagged a player.  Simple, right?  In practice it is, and there are heaps of scripts that already handle this precise function (herpetids come to mind: if the herpetid hits the player, then the player becomes increasingly intoxicated).

The catch: my script is a sort of a supplemental script which kind of hangs out in the background.  It isn't as plugged into combat system the same way as, say, the monster AIs scripts are.  My script is an independent entity, if you will, and just observes combat.

I completed the script and tested it.  What a disaster.  I spawned several monsters running my monitoring script, and while the monsters were knocking the stuffing out from me, my monitoring script observed my beat-down in awed silence.  That was bad.  The script should have been triggered by the monster's first damage delivery, and nothing happened.

Back to the drawing board.  I added my debugging notices.  I recompiled the script.  I generated more monsters running my script.  I got pwned by my monsters.  I cried – not because my monsters pwned me, but because after reviewing the logs I saw that my script was receiving absolutely no notification of my entering combat and subsequent pwnage.  I added more debugging notices.  More monsters.  More beat-downs.  And a lot more of nothing from the script.

At this point I felt that I failed to understand the mechanics of Clan Lord combat, so I started researching and reading about it.  It's a fascinating mechanic, IF YOU LOVE MATH.  Out of desperation (and by this point I was also nearly out of time), I then turned to the ServerGM and described my problem.  What was I doing wrong?  Why was my script ignoring combat?

ServerGM had the answer: this was not so much of a scripting issue as it was a timing issue.  ServerGM described what was happening:
  • At the beginning of each frame, all of the combat flags are cleared (Clan Lord runs roughly five frames per second)
  • My goofy script would then check the status of the combat flags and see that no combat had taken place
  • Then sometime before the end of the frame, combat would take place, and the appropriate combat flags would get set
  • The frame ends, combat resolves, and then we go on to the beginning of the next frame.
ServerGM recommended a couple of approaches to help achieve my intention for the script.  These suggestions worked brilliantly, and my script now correctly recognizes a monster tagging a player.

Maybe you'll encounter this script in v819.  BUT YOU HAD BETTER PRAY THAT YOU DONT HAHAHahaha hoo boy.

01 August 2013

Signs on Top of Signs

In another post, K'vynn commented:
Suddenly i'm envisioning a signpost forest springing up... signs on top of signs on top of...
I gave that some thought.  Well, at least from a technical standpoint.

In the first draft of the new signpost script, it was possible to have signs on top of signs.  Because the new signposts have no mask – one may not bump into them, nor could one sign collide into another – it was easy to dogpile signposts on top of each other.  In solving one problem, I had created another.  A player could move freely through a sea of signpost spam.

I have wedged a little bit of ugly code in to curtail this from happening (ugly in that it is not elegant scripting).  Now should the signpost detect another signpost nearby, then the player is prohibited from planting the signpost at that location.

A little more testing and this updated tool should be ready for prime time!

30 July 2013

Here's Your Sign

There's a lack of signs in Puddleby.  Specifically, there's a lack of signposts.

If you are unfamiliar with signposts: they are items which rarely turn up in town.  Bumping the signpost will reveal an action bubble and some text.  The rarity of such signs is – in my personal opinion – because of the risk of abuse in using the signs.  That is not to say that we GMs are concerned with players using adult language within the text: we're far too busy to be policing in-game language.

My perception of the problem is a (simple) technical issue: once a signpost is placed into play, it is there, and there it stays for the duration of its life.  I equate this to placing down a pretzel box that hangs around for an hour or so, regardless of how many player bump the box.  And I have seen the pretzel box maneuver several times: it is a clever way to creating a short-life obstacle for players which can not be circumvented by the sword, as with kudzu plants.  A couple of well-placed pretzel boxes on a narrow bridge makes that bridge impassible for as long as the pretzel box remains there.  In that vein, a couple of well-placed signposts could conceivably block players from entering (or leaving!) the library for much much longer than a life of a pretzel box.

I see a need for signposts.  They are great tool for in-game communication.  They just need an adjustment so that they are able to perform their job without behaving like a brick wall.  Or a stack of pretzel boxes.

I am working on a solution, and I hope to have revised signposts available for this upcoming update.



29 July 2013

if ( debugMode )

I have been struggling with my recent scripting project, and I found a simple solution: add a lot of announcement checkpoints throughout the script so that I may follow the script's progress:
    if ( debugMode ) log( "Scanning " + theIncomingText );
This was incredibly helpful in finding bottlenecks, missing data and other shenanigans caused by me whilst attempting to write this code quickly.  As a result of these internal announcements, I was able to find numerous bugs, squash them, and get my script running in an "as expected" manner!

Next up comes the long, dull portion of adding controls and restrictions (silly stuff, like "don't use a tinderbox while the player is under water" kind of logic).  But I am pleased to be reaching this point, as it is an indication of progress!

27 July 2013

Ice Cream Break

A very important part of scripting is to take an occasional ice cream break.  I am taking mine now (albeit a very, very late one).  I am making slow progress on my new tool – having found a seldom-used script which is similar in function – and I felt it was time to reward myself for this afternoon's work.

I am making a conscious effort to avoid dripping chocolate ice cream all over my new keyboard.

26 July 2013

When Easy Becomes Hard

I am developing a new tool.  The goal is to make the interface of this tool easy to use – roughly as simple as typing a macro trigger.

The challenge here is dealing with all of the possible variables in which a player may encounter.  Such quasi-relevant conditions for which I must plan: in what area is the player?  Where within the area is the player standing?  Who else is in the area?  Are there any environmental restrictions within the area?  How close are the players standing?  Is there any other activity surrounding the player?  What has changed since the last frame of action?

The more I think about what needs to be done on my part, the more daunting the project becomes.  All of these conditionals need to be reflected within the script if I want it to work simply and be easy to use.  I sincerely thought that this would have been a script which I could have written in two evenings.  I am on my second evening of development now, and predict that I may be working on this script all weekend.

Not that I am complaining.  Scripting is a nice way to spend the weekend.  I just wish that it wasn't so hard to write an easy script!

18 July 2012

The Dust Off

This morning I returned to something that I have not done in roughly four weeks: I opened up my text editor and added some preliminary code to a script.  It felt... well... comfortable to be scripting again – as if I had not been away from it for as long as I have.

I hope that everyone is having a relaxing summer!  It's hard to believe that it's nearly halfway over.

06 June 2012

H4X-kenstein

I made some time today to undertake the unpleasant task of sorting out an issue with one of my scripts.  The problem was not difficult, per se, it was – to quote Strong Bad – a quivering pile of not fun.  I would have preferred to have been doing something more stimulating and enjoyable.

The bird's eye view of the problem was that I had a script reading random, formatted data from a file, but there were two different types of data that I needed to read.  I had to think of a way of adding a second field of data without reorganizing the overall data structure.

I made it happen.  It wasn't a pretty solution, but now my beautiful creation can (metaphorically speaking) dance and sing!  And now that this is done, I can focus on some real fun stuff.

28 May 2012

Out With The Old

I have been wanting to update certain scripts in support of an upcoming theme-related update (and before you ask: I am sorry to say that it is not subclass-related).  This weekend, I was able to commit some time to updating two scripts, which involved retiring some old technology on which the scripts relied.  I also added some exciting, cool new features (and that is a very biased opinion on the features), and developed one new script to work in conjunction with these older scripts.

I still have a little work to do on these scripts.  They work just fine, and the enhanced functionality of these scripts could lead to a fun, quest-filled themed update.

27 April 2012

Cookies and Cola

That's this evening's dinner.

I have been working on organizing content for the V753 update since a little after noon today.  While doing some last minute additions, it came to my attention that one of the merchant NPC scripts does not support a function that I need for this update.  In fact, there are numerous merchant-related scripts and all of them do not support my needed function.  I could write the needed function, but I worry about the time remaining before my deadline.

Cookies and cola are certainly helping with the energy required to help me meet my deadline!  Hooray for caffeine and sugar!