Author Topic: The MultiFlute 0.5  (Read 7270 times)

0 Members and 1 Guest are viewing this topic.

Offline tekhnolyzeTopic starter

  • Jr. Member
  • **
  • Posts: 13
  • Activity:
    0%
  • Reputation Power: 1
  • tekhnolyze has no influence.
  • Respect: +1
  • Referrals: 0
    • View Profile
The MultiFlute 0.5
« on: July 26, 2011, 06:40:08 PM »
0
This is my first complete script that I think might be good enough to share with others. What it does is simple: its a menu that allows you to easily switch between each of your flutes of renewal (or other slayer/superslayer) and a GM instrument. My bard carries a full set of six flutes of renewal and a single GM-crafted instrument, which is the setup this script was written for. It could be adapted for other instrument sets as well, if necessary.

Instructions:
When you first start the script, you'll be prompted to set your instruments. This setup will store your instruments permanently so it only has to be done one time. Remember though, if you replace an instrument (your GM crafted one breaks for example), you'll have to run through the instrument setup again to register the new instrument. Also, the script does not yet differentiate between the different slayer types, so its up to you to choose the correct ones. The script will not correct it for you. If you mistakenly select the wrong instrument during setup, restart the script and do it again.

The Current Instrument line only tells you what instrument you most recently selected in the menu. So, if you manually use an instrument instead of choosing it through the script, that line will not update to reflect the change. You'll have to reselect an instrument in the menu for it to show a change.

Once this is done (or skipped), you'll be at the main menu, where you just select which instrument you want to use and it will automatically switch over to that instrument for you.

What this script does not do:
1) use any bard skills for you
2) prevent the loss/breakage of an instrument

Future changes that I plan to implement:
1) a counter that tells you how many uses are left on your current instrument
2) a failsafe to prevent you from using a flute of renewal when it gets down to one remaining use
3) an automatic continuous area peace toggle
4) possibly add in extra options for a single miscellaneous slayer instrument.

Anyway, this is my first real, solid script, and as far as I could tell its the only one that does what it does.

Dying to get some feedback whether good or bad, so tell me what you think and any suggestions to improve it would be GREAT!

There are 1 attachment(s) in this post. You must register and post an acceptable introduction to download
Multiflute.txt
« Last Edit: July 27, 2011, 01:53:33 AM by tekhnolyze »

Offline gimlet

  • Very Super Secret
  • Global Moderator
  • *
  • *
  • Posts: 6211
  • Activity:
    1.4%
  • Reputation Power: 71
  • gimlet is awe-inspiring!gimlet is awe-inspiring!gimlet is awe-inspiring!gimlet is awe-inspiring!gimlet is awe-inspiring!gimlet is awe-inspiring!gimlet is awe-inspiring!gimlet is awe-inspiring!gimlet is awe-inspiring!gimlet is awe-inspiring!gimlet is awe-inspiring!gimlet is awe-inspiring!
  • Gender: Male
  • Respect: +274
  • Referrals: 3
    • View Profile
Re: The MultiFlute 0.5
« Reply #1 on: July 26, 2011, 09:36:56 PM »
0
Nice idea!

Offline onlyindreams

  • Spaz Ferret's Personal Assistant
  • Insane Scripter
  • *
  • Posts: 1305
  • Activity:
    0%
  • Reputation Power: 13
  • onlyindreams barely matters.onlyindreams barely matters.
  • Respect: +96
  • Referrals: 2
    • View Profile
Re: The MultiFlute 0.5
« Reply #2 on: July 27, 2011, 12:32:35 AM »
0
Interesting! I'll give it a run next time I use my discorder!

Offline Cerveza

  • Hacksimus Maximus
  • Scripthack
  • *
  • Posts: 5857
  • Activity:
    0%
  • Reputation Power: 80
  • Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!
  • Gender: Male
  • So... Hows that Hopey-Changey thing working out?
  • Respect: +403
  • Referrals: 11
    • View Profile
Re: The MultiFlute 0.5
« Reply #3 on: July 27, 2011, 02:51:27 AM »
0
Nice job on your first contribution.

As always, there is room for improvement.

Initevents is not longer needed.

The "flow" is a bit erratic. Please take a look at the tutorials, especially script flow to see what I mean.

You really shouldn't be using gosubs to move around in a script the way you are, and when you DO gosub into a sub you should ALWAYS use return to get back to the point in the script where you "came from".

Here's an example:

Code: [Select]
1 - repeat
2 - gosub do_this
3 - gosub do_that
4 - until #false

6 - sub do_this
7 - stuff
8 - return

10 - sub do_that
11 - more stuff
12 - and more stuff
13 - return

Line 1 and 4 are a pair, repeat will continue to do everything between it and the next until, and then check the until statement to see if it's #TRUE. If it IS true then the condition is met and the script will continue past it. In our case, by setting the until to #FALSE we ensure it will NEVER be true. Thus making it a good main loop that will loop forever.

Line 2 and 3 are the gosubs. They will direct the script to immediately find a matching sub and execute whats inside.

Lines 6-8 are the first sub. Line 2 will execute and the script will skip down to line 6 and perform anything after the sub until it hits a return, in our case the return is line 8.

At this point you can start to see script flow. Using the numbers (which you would NOT use in a script, just for this posts purposes) the flow of this script is:

1-2-6-7-8-3-10-11-12-13-4

That pattern would continuously repeat itself.

Once you get that down, then you can use some condition stuff to determine if you even need to go to the sub routine.

Like if you need to cure a poison:

if C in #charStatus ; means you are poisoned
  gosub CURE

So if there is NO C in your #charStatus (not poisoned) it will NOT execute the next line.

Take a minute or 20 to read through the tutorials. I think you'll pick right up on improvements you could make to your MultiFlute right away! I even have some ideas about combining your sub routines ;) see anytime you use code in a script that is *really* similar, there is usually a way to reuse the same sub routine.
XXXXXXXXXX________________________________________] 20%
I've forgotten more about this game then most people will ever know.
Thank you for controlling your children. Their manners reflect your love for them.
Give a man a fish and you feed him for a day. Don't teach a man to fish, and you feed yourself. He's a grown man. Fishing's not that hard.

Offline Cerveza

  • Hacksimus Maximus
  • Scripthack
  • *
  • Posts: 5857
  • Activity:
    0%
  • Reputation Power: 80
  • Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!
  • Gender: Male
  • So... Hows that Hopey-Changey thing working out?
  • Respect: +403
  • Referrals: 11
    • View Profile
Re: The MultiFlute 0.5
« Reply #4 on: July 27, 2011, 03:53:37 AM »
0
Another quick thing...

display ok IMPORTANT!!! LONG LINE OF STUFF

You can break that into separate lines by putting in the $ char. That will end one line and begin another.

This line is way too long. It just goes on forever. But there are good stopping points.

Changed to

This line is way too long.$It just goes on forever.$But there are good stopping points.

Becomes

This line is way too long.
It just goes on forever.
But there are good stopping points.

I'd recommend breaking up that super long line into shorter segments using $

****************************

I see you are using * variables, which isn't bad but they are used more commonly in scripts which send info to other scripts through the registry. A better variable for a stand alone script like yours would be %

set *arachnid #ltargetid

should be

set %arachnid #ltargetid

You really should only use the * variables if you want interaction between scripts, not like this script which runs alone.
« Last Edit: July 27, 2011, 03:55:47 AM by Cerveza »
XXXXXXXXXX________________________________________] 20%
I've forgotten more about this game then most people will ever know.
Thank you for controlling your children. Their manners reflect your love for them.
Give a man a fish and you feed him for a day. Don't teach a man to fish, and you feed yourself. He's a grown man. Fishing's not that hard.

Offline tekhnolyzeTopic starter

  • Jr. Member
  • **
  • Posts: 13
  • Activity:
    0%
  • Reputation Power: 1
  • tekhnolyze has no influence.
  • Respect: +1
  • Referrals: 0
    • View Profile
Re: The MultiFlute 0.5
« Reply #5 on: July 27, 2011, 04:01:52 AM »
0
Another quick thing...

display ok IMPORTANT!!! LONG LINE OF STUFF

You can break that into separate lines by putting in the $ char. That will end one line and begin another.

I'll add that in. I wanted to break it up but I couldn't figure out how to do it, so had to stick with the long line.

Quote
I see you are using * variables, which isn't bad but they are used more commonly in scripts which send info to other scripts through the registry. A better variable for a stand alone script like yours would be %

I use * because I want the instrument setup to be saved between uses of the script so they don't have to be reset every time you open it. Is there a different way to do this? AFAIK % variables clear after the script is stopped.

Offline Cerveza

  • Hacksimus Maximus
  • Scripthack
  • *
  • Posts: 5857
  • Activity:
    0%
  • Reputation Power: 80
  • Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!
  • Gender: Male
  • So... Hows that Hopey-Changey thing working out?
  • Respect: +403
  • Referrals: 11
    • View Profile
Re: The MultiFlute 0.5
« Reply #6 on: July 27, 2011, 04:43:34 AM »
0
It's not a problem to use the * variables. If everyone did, you would have one cluttered registry though.

To resolve that issue, consider a later version that would automate the flute finding for you ;)

Spoiler: show
Read up on event property and #property
XXXXXXXXXX________________________________________] 20%
I've forgotten more about this game then most people will ever know.
Thank you for controlling your children. Their manners reflect your love for them.
Give a man a fish and you feed him for a day. Don't teach a man to fish, and you feed yourself. He's a grown man. Fishing's not that hard.

Offline tekhnolyzeTopic starter

  • Jr. Member
  • **
  • Posts: 13
  • Activity:
    0%
  • Reputation Power: 1
  • tekhnolyze has no influence.
  • Respect: +1
  • Referrals: 0
    • View Profile
Re: The MultiFlute 0.5
« Reply #7 on: July 27, 2011, 09:56:20 AM »
0
It's not a problem to use the * variables. If everyone did, you would have one cluttered registry though.

To resolve that issue, consider a later version that would automate the flute finding for you ;)

Spoiler: show
Read up on event property and #property


I tried to go this route, but I couldn't figure out how to correctly parse the output. Best I could do is the manual selection I used. If you could point me to a sub that would either work in its place or that I could adapt to fit my needs, it'd be fantastic :) I looked, but couldn't find anything. Didn't see any good tutorials on parsing either.

Offline UOMaddog

  • Maddog
  • Elite
  • *
  • *
  • Posts: 1625
  • Activity:
    0%
  • Reputation Power: 22
  • UOMaddog might someday be someone...UOMaddog might someday be someone...UOMaddog might someday be someone...UOMaddog might someday be someone...
  • Gender: Male
  • Biggest B@D@$$ of the Universe
  • Respect: +165
  • Referrals: 8
    • View Profile
    • Insane UO
Re: The MultiFlute 0.5
« Reply #8 on: July 27, 2011, 03:00:51 PM »
0
I must admit I have not run the script because I'm writing this from my laptop.

First, I must say that I love the idea of this script. As I was reading it, I was trying to envision it and when I was reading your future additions an idea popped into mind! The menu could look like the picture below:



Anytime an instrument was used up (or could not be found in the pack because it was removed), the script would attempt to find another one. If it failed, the button turns red (and either not able to be selected or if clicked, defaults to a GM instrument). If it does find one, it updates the button to show how many uses are remaining on that particular instrument (and maybe in a future one, could scan all instruments and show a total number of uses for all instruments in the pack, though it would consume a lot more in terms of resources).

Just some ideas to throw out there!!

Good luck and I'll test it when I'm completely back up and running!
There are 10 kinds of people in this world: those that understand binary and those that don't!

Windows:  A 64-bit tweak of a 32-bit extension to a 16-bit user interface for an 8-bit operating system based on a 4-bit architecture from a 2-bit company that can't stand 1 bit of competition!

Offline tekhnolyzeTopic starter

  • Jr. Member
  • **
  • Posts: 13
  • Activity:
    0%
  • Reputation Power: 1
  • tekhnolyze has no influence.
  • Respect: +1
  • Referrals: 0
    • View Profile
Re: The MultiFlute 0.5
« Reply #9 on: July 29, 2011, 03:30:50 PM »
0
When I replace the gosub mainmenu lines with return at the set of subs at the bottom where it switches the instrument, it returns to the top of the script rather than to sub mainmenu. I'm not really seeing why

Offline Endless Night

  • Global Moderator
  • *
  • *
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +393
  • Referrals: 1
    • View Profile
Re: The MultiFlute 0.5
« Reply #10 on: November 02, 2011, 08:12:42 PM »
0
Script moved to script debug.
(If you disagree with the move please pm me.)
Thank you for the script submission

This script generated quiet a bit of interest .. I would recommend that you finish it and get that first script contribution under your belt.
Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Offline tekhnolyzeTopic starter

  • Jr. Member
  • **
  • Posts: 13
  • Activity:
    0%
  • Reputation Power: 1
  • tekhnolyze has no influence.
  • Respect: +1
  • Referrals: 0
    • View Profile
Re: The MultiFlute 0.5
« Reply #11 on: November 14, 2011, 12:02:30 PM »
0
Script moved to script debug.
(If you disagree with the move please pm me.)
Thank you for the script submission

This script generated quiet a bit of interest .. I would recommend that you finish it and get that first script contribution under your belt.


Took a bit of a UO break and put this on the back burner. But I'm back for now so I'll be finishing it soon

Offline Khameleon

  • Script Tester - Team Leader
  • Elite
  • *
  • *
  • Posts: 2574
  • Activity:
    0%
  • Reputation Power: 30
  • Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!
  • Gender: Male
  • Respect: +238
  • Referrals: 0
    • View Profile
Re: The MultiFlute 0.5
« Reply #12 on: November 16, 2011, 05:12:43 PM »
0
This Script actually has given me some insight, not only for bards but for switching Spell Books on mages... Now only if EUO was up I would have started to write something tonight.

Offline DPeterson

  • Newbie
  • *
  • Posts: 6
  • Activity:
    0%
  • Reputation Power: 1
  • DPeterson has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: The MultiFlute 0.5
« Reply #13 on: November 26, 2011, 09:16:57 AM »
0
Here's a bit of code to get ya moving in the right direction so you don't have to target your flutes every time.

Code: [Select]
  finditem PGP c_ , #backpackid
  for #findindex 1 #findcnt
  {
     event property #findid
     if arachnid in #property
       set !slayer1 #findid
     if elemental in #property
       set !slayer2 #findid
     if demon in #property
       set !slayer3 #findid
     if reptile in #property
       set !slayer4 #findid
     if repond in #property
       set !slayer5 #findid
     if undead in #property
       set !slayer6 #findid
  }

Offline Crome969

  • Elite
  • *
  • *
  • Posts: 2098
  • Activity:
    0%
  • Reputation Power: 25
  • Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.
  • Gender: Male
  • UO Enthusiast
  • Respect: +211
  • Referrals: 10
    • View Profile
    • ScriptSDK
Re: The MultiFlute 0.5
« Reply #14 on: November 26, 2011, 10:43:25 AM »
0
Here's a bit of code to get ya moving in the right direction so you don't have to target your flutes every time.

Code: [Select]
  finditem PGP c_ , #backpackid
  for #findindex 1 #findcnt
  {
     event property #findid
     if arachnid in #property
       set !slayer1 #findid
     if elemental in #property
       set !slayer2 #findid
     if demon in #property
       set !slayer3 #findid
     if reptile in #property
       set !slayer4 #findid
     if repond in #property
       set !slayer5 #findid
     if undead in #property
       set !slayer6 #findid
  }
The Idea is not bad, what i miss, why only flutes? what is with my regular slayer tools?

Tags: