Neparr
03-06-2014, 02:36 PM
I was playing around with writing a basic script for shattered that will ask for Alfred to make some bread while I'm burning down in TSC and castings buffs.
The intent is to have it look and see if Alfred is in the room. If he is then ask for some bread and grab it when it drops. That part works fine. I also want to add a little redundancy to it such that. If he is not in the room instead of ending the script like it does now it waits a certain amount of time and checks again. Lets say it waits 15 seconds between checks. If Alfred is in the room but otherwise engaged in an activity and is unable to make bread at that time it wont get hung up looking for the bread to be dropped and instead times out from the waitfor after say 30 seconds. In this case the script could just end so that it isnt getting hung up. I tried to establish a label that i could use as a reference for a goto command to bound back to the top of the script. My attempt looked like so. Any thoughts from the experienced writers out there. I'm still very new at this but i imagine i will pick it up quickly. Still learning arrays.
label 'MainLabel'
if checkpcs.include?('Alfred')
fput 'whisper alfred bread'
waitfor "Alfred drops a spinach-paste steamed dumpling."
multifput "get dumpling", "gobble my dumpling", "gobble my dumpling", "gobble my dumpling"
else
pause '15s'
goto 'MainLabel'
end
The intent is to have it look and see if Alfred is in the room. If he is then ask for some bread and grab it when it drops. That part works fine. I also want to add a little redundancy to it such that. If he is not in the room instead of ending the script like it does now it waits a certain amount of time and checks again. Lets say it waits 15 seconds between checks. If Alfred is in the room but otherwise engaged in an activity and is unable to make bread at that time it wont get hung up looking for the bread to be dropped and instead times out from the waitfor after say 30 seconds. In this case the script could just end so that it isnt getting hung up. I tried to establish a label that i could use as a reference for a goto command to bound back to the top of the script. My attempt looked like so. Any thoughts from the experienced writers out there. I'm still very new at this but i imagine i will pick it up quickly. Still learning arrays.
label 'MainLabel'
if checkpcs.include?('Alfred')
fput 'whisper alfred bread'
waitfor "Alfred drops a spinach-paste steamed dumpling."
multifput "get dumpling", "gobble my dumpling", "gobble my dumpling", "gobble my dumpling"
else
pause '15s'
goto 'MainLabel'
end