Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Suggestions ➜ Plugin Wizard

Plugin Wizard

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Shadowfyr   USA  (1,792 posts)  Bio
Date Fri 09 Aug 2002 09:04 PM (UTC)

Amended on Fri 09 Aug 2002 09:05 PM (UTC) by Shadowfyr

Message
>...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?
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Fri 09 Aug 2002 09:20 PM (UTC)
Message
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).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Shadowfyr   USA  (1,792 posts)  Bio
Date Reply #2 on Fri 09 Aug 2002 10:31 PM (UTC)
Message
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.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #3 on Fri 09 Aug 2002 10:40 PM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Shadowfyr   USA  (1,792 posts)  Bio
Date Reply #4 on Fri 09 Aug 2002 11:13 PM (UTC)
Message
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.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #5 on Sat 10 Aug 2002 12:45 AM (UTC)
Message
Quote:

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


No.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


14,706 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.