Ok, so I'm working on understanding and writing a couple of simple scripts. I'm getting close enough to writing and modding my own scripts that this is getting exciting, but I'm running into tons of errors when I try to do things myself because I'm making assumptions and guesses without really understanding and it's causing me to run into very frustrating blocks.
As an example, I downloaded a script that by itself looks very simple and very easy to understand. I have a few questions though and I'm hoping to get a hand in figuring it out: If this is someone's script and you don't want me posting it up as an example and/or modding it, please send me a PM and I'll delete this post. I'll post the script and ask my question next to the lines I have questions about.
Here's the script, called "Instrumentskilllevel":
# Will level your instrument skill while you rest
# If you leave the room you started the script in, script will kill on the next PLAY attempt
# Edit to config instrument
##########
# Config #
##########
instrument = "flute" <----I understood this, no problems same with styles
styles = ["Joyful","Mournful","Soft","Fast","Slow","Intense" ,"Jaunty","Flamboyant","Aimless","Somber","Inspiri ng"]
##########
##########
##########
echo "################################################# ##########"
echo "################################################# ##########"
echo "Leveling your #{instrument} skill until you leave this room"
echo "################################################# ##########"
echo "################################################# ##########"
restRoomId = Room.current.id <----this is just to set the room I'm in as the "rest room" right?
fput "stow all"
fput "get my #{instrument}" <---Is the reason the # is there is because it's a variable?
style = 0; This is to set the style at 0, so that later on when it goes "Style +1" it will start at joyful, right?
while Room.current.id == restRoomId This is what stops the script if I move, but why two ='s?
fput "play my #{instrument} #{styles[style]}" <---Why is it #{styles[style]}?
style = (style + 1) % styles.length <---what does % and styles.length tell you? I assume it somehow tells the script to wait until the style is finished playing?
sleep 330
end
So if I wanted this script to end after a specified time or after two or three styles, could you point me in the right direction for changing it efficiently? I know a lot of you who are experienced at this would want me to learn, and so do I. I appreciate your help.