ScriptUO
Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: Superslayer on February 22, 2009, 04:38:54 PM
-
As I write my first script (the roam one going on 1500 lines without the rails even) I have some notes at the top as 'Goals' to achieve. At this moment, I'm rather wondering, do I need to have an offset gump option available, and if so, how so? Currently I play on a 1280 x 1024 20" screen and the UO options are 1024 x 768 full screen resolution option and the game play window at 800 x 600. I have in my script, parts where gumps are moved to a place, clicks made, runebooks opened and click made and the such.
-
If you check out this little script:
http://www.scriptuo.com/smf/index.php?topic=505.0;highlight=click
I used this all the time to generate the correct click offsets for screen locations.
It works wonders; I use it just about every script I develop.
-
Same thing I do. Simple fool proof solution :)
-
So as I understand it, I personally won't need to incorporate this sub in my script, but users of my script can use this sub? Or...I can actually have it in my script, but keep it commented out for me, and just let users aware that it is there and can/should be used/uncommented?
-
The only thing you have to integrate into your script is this:
sub OffsetClick
set %tempx %1 + #CONTPOSX
set %tempy %2 + #CONTPOSY
click %tempx %tempy f
return
Whether you write one yourself, or use that one. Just about every scripter out there has generated a sub like this to adjust for gump coordinates mapped to the screen. You start out coding all those clicks by hand, but you'll soon find that you are going to be using the same type of code a 100 times over. So that's when you just make a little click sub out of it.
The script I linked for you just help you generate the offset coordinates so you can cut/paste the resulting offset values.
A note on why we really need a sub like this
When you've coded enough, you might think that code like this should function:
click %tempx + 200 %tempy + 200 f
However, in EasyUO it doesn't know how to parse this. So that's why you have to do the math before you actually use the CLICK command.
At this point, I get to poke fun at the lame EasyUO parser again.. ScriptUO knows how to parse this expression. ;)
-
Thanks TM, again. It surprisingly makes sense.
-
When you've coded enough, you might think that code like this should function:
click %tempx + 200 %tempy + 200 f
Haha you have no idea how often I tried to make things like that work ;*(
It would make code so much cleaner though if you could do things like that ;/
-
absolute life savers and allows everyone to use your code regardless of resolution. I don't remember when I learned this but it was from cerv or TM and it is a life changer!
-
absolute life savers and allows everyone to use your code regardless of resolution. I don't remember when I learned this but it was from cerv or TM and it is a life changer!
Musta been TM, I'm only semi-literate.
-
does this actualy move the gump to a diff spot? thats what i need to do. i need to open a crafting gump and move it off the main play screen i dont use full size res so i have some room
-
No, this just makes whatever gump you are addressing usable. For you, just change the #CONTPOSX and #CONTPOSY. Also, if you change the #NEXTCPOSX and #NEXTCPOSY before you open the gump, then it will open where you want it.
-
does this move a gump ? lol sorry you replied fast to that one
-
#CONTPOSX and #CONTPOSY will move the current gump or container.
#NEXTCPOSX and #NEXTCPOSY will allow you to specify the position of the next opened gump/container.
-
every time i think i have a grasp of what is going i realise i dont have a clue lol
-
Ah, you'll get it. Best thing is to do what I did and just play with it.... ;)
-
every time i think i have a grasp of what is going i realise i dont have a clue lol
I remember when all i knew to do with finditem was if #findkind = -1.
The more code you read and follow through , the more you will learn about how gumps are moved and placed, and different variables can be used and checked. I just upgraded my pot maker to 2.0b and in the script i move the packs around to specific locations. I also do it in other scripts including a really simple on, c2's keg emptier. That is a good one to read through for reference. It is over at winuo.org though. I am starting to put a few scripts up here though too. Need to put some out in public though.
-
this thread can be deleted
-
Good for others to learn from, I'll remove it if you really want.
-
good point. I may actually reference it again as well.