Plugin Wizard

Posted by Shadowfyr on Fri 09 Aug 2002 09:04 PM — 6 posts, 14,987 views.

USA #0
>...and deletes the selected triggers/aliases/timers/ plugins from the main MUSHclient file...

Umm.. Doesn't this sort of assume that the subs involved are in the final form you want released? For my Druid Potions plugin I am currently doing I have no immediate plans to replace the hard coded version I use with the final plugin (which builds the lists it uses as one plays). You may want to make this an optional effect.

Also.. What happens if the plugins script calls some secondary sub or function . One thing I have considered doing was making a function like>

function Array_Remove(original, position)
  dim temp
  temp = split(original,",")
  dim temp2(ubound(temp - 1))
  for count = 0 to ubound(temp) - 1
    if count < position then
      temp2(count) = temp(count)
    else
      temp2(count) = temp(count + 1)
    end if
  next
  Array_Remove = join(temp2,",")
end function


I see two problems here. The first problem that such a function (which imho should be a standard library function for arrays in languages) may be used by more than just that plugin. The second problem is, does the wizard look for such occurances in the subs and automatically include them?
Amended on Fri 09 Aug 2002 09:05 PM by Shadowfyr
Australia Forum Administrator #1
It doesn't delete the script, so there is no assumption that you won't keep it. It would be hard, in any case, to know exactly what parts of the script to take.

That is why you can edit the script (in the wizard) and delete non-relevant bits. The edited script is then in the plugin.

However after that I suggest editing the plugin file itself to make further changes rather than being in some sort of half-plugin, half-worldfile state.

As for standard libraries, make them a separate file and throw in an "include" statement into the plugin (you might have to do that manually, however there is an example in the form of the 'standard constants' one).
USA #2
Yeah.. A seperate file would be handy. lol

Actually the funtion I listed here. Assuming I didn't goof it, would be a nice standard addition for something similar to the constants file. Maybe 'standard functions'? There are bound to be solution like mine which would make life easier for everyone if they where available with the download, instead of poking around in peoples scripts trying to find them. Feel free to steal it. ;)

I only wish that the blasted glitch in vbscripts treatment of implied variable definitions didn't force me to use two arrays, instead of one. I tried it with only one, but the array will resize itself, but unless you 'redim' it you can use 'preserve' to keep the data in it. :p But you also can't redim it without knowing how many elements you will get first. Bloody stupid... :p

Hmm. Though, I wonder...
function Array_Remove(original, position)
  redim temp(ubound(split(original,",")))
  temp = split(original,",")
  for count = position to ubound(temp) - 1
    temp(count) = temp(count + 1)
  next
  redim temp(ubound(temp) - 1)
  Array_Remove = join(temp2,",")
end function

could maybe work.. It is definitely closer to what I wanted.
Australia Forum Administrator #3
For removing an item from an array, what about the method I used in the random_socials plugin, in function Do_Remove_Social? This works on the expanded string (you could use commas rather than spaces, or some other character). It does it by doing a "replace" on the string rather than working on the arrays directly.
USA #4
Yes, that works in most cases. For mine though you would type something like:

potions:remove blah

and the string would contain:

blah:gol/gin/hea,bandage:/gol/min/pep

or the like. To remove one element using replace it needs to contain 'only' that element plus something obvious like the ",". I do that in one or two cases, but it should be easier to yank something out of a true array, where you need only identify the element to be removed. Sadly, it isn't.
Australia Forum Administrator #5
Quote:

The second problem is, does the wizard look for such occurances in the subs and automatically include them?


No.