ScriptUO
Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: camotbik on August 14, 2011, 06:40:07 PM
-
Is something like this even possible?
menu List Create EUOListBox1 0 0 249 520
finditem * C_ , #backpackid
for #FINDINDEX 1 #FINDCNT
{
event property #findid
str pos #property $ 1
set %lenght #strres - 1
str left #property %lenght
set %name #strres
if #findstack = 1
{
if % , #findtype , #findcol , ammount = N/A || % , #findtype , #findcol , ammount = 0
{
set % , #findtype , #findcol , ammount #findstack
menu List Add EUOListBox1 % , #findtype , #findcol , ammount %name
}
else
set % , #findtype , #findcol , ammount % , #findtype , #findcol , ammount + #findstack
}
else
menu List Add EUOListBox1 %name
}
menu Window Size 246 561
menu Show
halt
-
The Question is for your Example, is that needet?
Example of my Doom Script for Menu:
str pos #property $
set %helper #strres - 1
str left #property %helper
set %Artifactname #strres
menu List Add EUOListBox1 %Artifactname
Making infinite Amount of %Variables wich you only using one time is just a mess of running out of Ram.. Or am I wrong?
-
you've almost got it. EUO supplies to different kinds of reference operators. There's the right-associative "," and the left-associative "."
So if you change your line:
set % , #findtype , #findcol , ammount #findstack
to this:
set % . #findtype , #findcol , ammount #findstack
Then I think it'll work the way you are thinking.
-
you've almost got it. EUO supplies to different kinds of reference operators. There's the right-associative "," and the left-associative "."
So if you change your line:
set % , #findtype , #findcol , ammount #findstack
to this:
set % . #findtype , #findcol , ammount #findstack
Then I think it'll work the way you are thinking.
Yeah of Course. But behind the Back(And i know that about talking before with Camotbik in icq) it would work, but doesnt have any reason more than creating a lot of Variables with a one usage.
and
set % . #findtype , #findcol , ammount #findstack
istn there a , missing?
set % . #findtype , #findcol , ammount ,#findstack
Crome
-
it seems that EUO doesnt work the way i was planing
finditem * C_ , #backpackid
for #FINDINDEX 1 #FINDCNT
{
set %FT #FindType
set %FC #FindCol
set %TC %FT , %FC
if %TC , Allready_in_list = #TRUE
DISPLAY IT WORKS
set %TC , Allready_in_list = #TRUE
}
-
it seems that EUO doesnt work the way i was planing
finditem * C_ , #backpackid
for #FINDINDEX 1 #FINDCNT
{
set %FT #FindType
set %FC #FindCol
set %TC %FT , %FC
if %TC , Allready_in_list = #TRUE
DISPLAY IT WORKS
set %TC , Allready_in_list = #TRUE
}
I've worked a little with associativity in a bod script I wrote, I use it to get item types from bod properties...
Imagine the Bod i'm talking about is to craft Bronze Shields. I have a preset list of item types. Bronze Shield will be there like this:
set !_Bronze_Shield GIK
I use strings to get the item name from the bod. I have a sub that will return Bronze , #spc , Shield from the string, which will be added to a variable:
set !item_name Bronze , #spc , Shield
Then I have another sub that I call using the !item_name var:
gosub gettype !item_name
this sub will work with the !item_name (Bronze Shield) and result in a string with underscore:
set !string Bronze_Shield
I then set the result like this before returning:
set #result !_ . !string
return #result
so the #result var will contain exactly the !_Bronze_Shield var which is GIK
From all the testing I did with associativity, the best (only?) way to make this work is to combine a maximum of 2 strings each time to get a resulting var.
-
it seems that EUO doesnt work the way i was planing
finditem * C_ , #backpackid
for #FINDINDEX 1 #FINDCNT
{
set %FT #FindType
set %FC #FindCol
set %TC %FT , %FC
if %TC , Allready_in_list = #TRUE
DISPLAY IT WORKS
set %TC , Allready_in_list = #TRUE
}
Error in this line: if %TC , Allready_in_list = #TRUE
if #findtype = ABC and #findcol=22 then this evaluates to: if ABC22Allready_in_list = #TRUE
Which of course will always be false as ABC22Allready_in_list is not a valid var name and thierfor holds no value.
What you need to do is go one step further in the abstraction.
set %TC %FT , %FC , Allready_in_list
if % . %TC = #TRUE
DISPLAY IT WORKS
set % . %TC #TRUE ; no =
see how if % . %TC = #TRUE now evaluates to
if %ABC22Alleady_in_list = true
which is of course is a valid var name.
-
Well thank you EN, now I've finally got further in this.
event SysMessage Target storage
set #targcurs 1
while #targcurs <> 0
wait 1
set %storage #ltargetid
set #lobjectid %storage
while #contid <> %storage
{
event macro 17
wait 5
}
menu List Create EUOListBox1 0 0 249 520
finditem * C_ , %storage
for #FINDINDEX 1 #FINDCNT
{
set %FT #FindType
set %FC #FindCol
set %TC %FT , %FC
event property #findid
str pos #property $ 1
set %lenght #strres - 1
str left #property %lenght
set %name #strres
if #findstack = 1
{
if % . %TC = #TRUE
{
set %TC . 1 %TC . 1 + #FINDSTACK
;display %name %TC . 1 ; for debuging purposes
}
else
{
set %TC . 1 #FINDSTACK
set % . %TC #TRUE
menu List add EUOListBox1 %TC . 1 %name
}
}
else
menu List Add EUOListBox1 %name
}
menu Window Size 246 561
menu Show
halt
But I'm still new to the menus and I've have now a menu issue.
for example.
menu List Create EUOListBox1 0 0 249 520
menu List Add EUOListBox1 Test %count
for %i 1 5
{
set %count %count + 1
}
menu Window Size 246 561
menu Show
halt
I've need to get this some how working, to complete the above script..
The thing is that the variable isn't updating after I've popup the menu window. It Sets the %count that it has on the exact moment that I've set it, and I'm sure there is a possible way to do this, but I'm currently not familiar with it..
Ps; and i know that i have to set the "menu List Add EUOListBox1 Test %count" after the counting, but i've need this to work this way, so i haven't have to write all the item names by hand..
This could be easily solved if there was a way to create an own set queue like in #findindex, to execute your prefered lines..
-
menu List Create EUOListBox1 0 0 249 520
for %i 1 5
{
menu List Add EUOListBox1 Test %i
}
menu Window Size 246 561
menu Show
halt
-
I know this works this way, but I need to get it working the way I've showed above, some how...
-
Ok now so the people would understand what it was all about.. Here's a running test version.
(http://img854.imageshack.us/img854/5802/listh.jpg)
menu Clear
menu Window Title Testing stats
menu Window Color BtnFace
menu Window Size 246 561
menu Font Transparent #true
menu Font Align Right
menu Font Name MS Sans Serif
menu Font Size 8
menu Font Style
menu Font Color WindowText
menu Font Transparent #false
menu Font Align Left
menu Text EUOLabel1 4 524 Press start to proceed
menu Font Name Default
menu Font Color Black
menu Font Name Default
menu Font Color Black
menu Button Start 132 524 109 33 Start
menu Show
start:
while #MENUBUTTON <> START
{
wait
}
menu List Create EUOListBox1 0 0 249 520
set #MENUBUTTON N/A
menu Delete EUOLabel1
menu Text EUOLabel1 4 524 Select container
set #targcurs 1
while #targcurs <> 0
wait 1
set %storage #ltargetid
set #lobjectid %storage
while #contid <> %storage
{
event macro 17
wait 5
}
menu Delete EUOLabel1
menu Text EUOLabel1 4 524 Creating a list..
finditem * C_ , %storage
while #findcnt > 0
{
set %FT #FindType
finditem %FT C_ , %storage
while #findcnt > 0
{
set %FC #FindCol
set %kol 0
set %kolstack 0
for #FINDINDEX 1 #FINDCNT
{
if #FINDCOL = %FC
{
set %kol %kol + 1
event property #findid
str pos #property $ 1
set %lenght #strres - 1
str left #property %lenght
set %name #strres
if #findstack > 1
{
str Len #findstack
set %lenght #strres + 1
str Del %name 1 %lenght
set %kol 0
set %kolstack %kolstack + #findstack
}
ignoreItem #FINDID
}
}
if %kol > 0
menu List add EUOListBox1 %kol #strres ;%FT %FC
if %kol = 0
menu List add EUOListBox1 %kolstack #strres ;%FT %FC
finditem %FT C_ , %storage
}
finditem * C_ , %storage
}
ignoreItem reset
menu Delete EUOLabel1
menu Text EUOLabel1 4 524 List created.
goto start