ScriptUO

Scripting Resources & Utilities => OpenEUO Scripts => OEUO => OEUO Snippets => Topic started by: Crome969 on August 02, 2011, 10:36:09 PM

Title:
Post by: Crome969 on August 02, 2011, 10:36:09 PM
Hello Scripuo Community,
do you know the Problem?
you want to walk in a specific amount of Tiles and must look at Charposition calulcate tiles or give a static Position?
Why cant this be a variable?
Today i want to show you a small Solution:

Code: [Select]
--########################################
--@Name          MoveTiles
--@Author        Crome696
--@Purpose       Move in looking direction or reversed direction
--@ReleaseDate 08\01\11
--@Version        1.0
--@TestedClient 7.0.16.1
--@TestShard    Osi\Osiclone
--########################################           
function MoveTiles(tmpTiles,tmprev,tolerance,timeout)
dir = UO.CharDir + 1
rev = {5,6,7,8,1,2,3,4}
if(tmprev==true)then tmpdir = rev[dir] else tmpdir = dir end
mpath = {}
mpath[1] = {(UO.CharPosX ),(UO.CharPosY - tmpTiles)}
mpath[2] = {(UO.CharPosX + tmpTiles),(UO.CharPosY - tmpTiles)}
mpath[3] = {(UO.CharPosX + tmpTiles),(UO.CharPosY)}
mpath[4] = {(UO.CharPosX + tmpTiles),(UO.CharPosY + tmpTiles)}
mpath[5] = {(UO.CharPosX ),(UO.CharPosY + tmpTiles)}
mpath[6] = {(UO.CharPosX - tmpTiles),(UO.CharPosY + tmpTiles)}
mpath[7] = {(UO.CharPosX - tmpTiles),(UO.CharPosY - tmpTiles)}
mpath[8] = {(UO.CharPosX - tmpTiles),(UO.CharPosY - tmpTiles)}
UO.Move(mpath[tmpdir][1],mpath[tmpdir][2],tolerance,timeout)
end

This function will move your Char in specific Tiles forward or reversed.
(http://img24.imageshack.us/img24/7029/mulpath.jpg) (http://imageshack.us/photo/my-images/24/mulpath.jpg/)
[/URL]
Example:
Code: [Select]
MoveTiles(1,false,0,0)You are Looking in Chardirection "0" then it will move 1 Tile in direction 0 without a timeout and 0 tiles tolerance
Code: [Select]
MoveTiles(1,true,0,0)Now reversing is enabled so it will move 1 tile in Chardirection 4 (Opposite of 0, view Picture)
if you set tolerance > 1 it will be done with moving if Char is within the tolerance range to wanted Tile Range.
If you set timeout >1 Moving is finished when it reached time > timeout seconds.

Usage:
In some of my Scripts i need to runaway from target. Like you need to heal or lure Monsters away. So you can use this function to move away.
Other Usage is maybe in Tilebased Skilling Scripts. you now dont need to look on your Charposition and calculate 8 tiles just use:
Code: [Select]
MoveTiles(8,true,0,0)
Hope it will be Useful for you guys,too.

Kind regards

Crome
Title:
Post by: gimlet on August 03, 2011, 07:40:02 AM
Very nice - is this in openEUO?
Title:
Post by: Cerveza on August 03, 2011, 08:13:14 AM
Title:
Post by: Crome969 on August 03, 2011, 08:49:43 AM
Title:
Post by: gimlet on August 03, 2011, 09:28:16 AM
Can you call an open euo function from euo (or vis versa)

Title:
Post by: Crome969 on August 03, 2011, 09:41:50 AM
Can you call an open euo function from euo (or vis versa)
well you can make a library file and Open it Via
dofile(getinstalldir().."Yourpathandfolderns..\yourlibraryfile.lua")
so i handle it like:


dofile(getinstalldir().."Library\finditem.lua")
dofile(getinstalldir().."Library\crome_base.lua")
dofile(getinstalldir().."Library\crome_Login.lua")
dofile(getinstalldir().."Library\Sending.lua")
dofile(getinstalldir().."Library\Crome_Tamer.lua")

and atleast.. all these just staying once in a file named "Init.Lua" in my Main Openuo Folder
and then i call
dofile(getinstalldir().."Init.lua")
and that file calls those Library files.
And i can use em in my script with just 1 Line in every new Script.

But if you mean OUO in EUO i must disapoint you.
Openuo uses lua, Easyuo dont know what lua is.
Maybe if you write an Integration for Luasyntax you could.
But before you do that. Do Openuo:):)
Title:
Post by: Goliath on August 03, 2011, 06:03:47 PM
Nice work