Yoko

All sides of Injection
It is currently 2026-01-26 01:21:18

All times are UTC+02:00




Post new topic  Reply to topic  [ 17 posts ] 
Author Message
 Post subject: Counting in hex
PostPosted: 2006-07-20 07:23:49 
Offline

Joined: 2004-05-16 16:23:27
Posts: 37
Is there a way to count or convert decimal numbers to hex? i'm using a script that i need to have values from 1-ffff and i don't want to manually write conversion code if it already exists.


Top
   
 Post subject:
PostPosted: 2006-07-20 08:32:10 
Offline
Expert!
User avatar

Joined: 2005-01-15 19:15:05
Posts: 791
Location: Dragon World
http://yoko.com.ua/help/help.php?lang=r ... em=Int2Hex

_________________
Image


Top
   
 Post subject:
PostPosted: 2006-07-20 08:43:21 
Offline

Joined: 2004-05-16 16:23:27
Posts: 37
EDIT: Ok, that worked, sort of.

Is there any way to do it without it being preceeded by 0x?

The command would accept an input of 000c, or 0c, or preferably just c, but it won't take 0x00000c.


Top
   
 Post subject:
PostPosted: 2006-07-20 10:23:48 
Offline
Expert!
User avatar

Joined: 2004-04-04 11:13:54
Posts: 1205
Location: Балаково, Саратовская обл.
Code:
i='0f00'
hex='0x'+i


Top
   
 Post subject:
PostPosted: 2006-07-20 11:10:56 
Offline

Joined: 2004-05-16 16:23:27
Posts: 37
I need to convert a decimal number to hex, without the 0x prelude. I think you misunderstood me. I did not need to prefix 0x, just need a way to count from 1 to ffff in hex, without doing it in decimal + 1 then converting manually through long hard math.


Top
   
 Post subject:
PostPosted: 2006-07-20 12:30:16 
Offline
Expert!
User avatar

Joined: 2005-09-14 15:31:58
Posts: 2152
Location: Latvia
Code:
uo.Int2Hex(number)

uo.Hex2Int(text)

_________________
Уроки языка Injection
Основные команды языка Injection
Yoko Injection Code Sweeper
Drw (2009) скрипты
2017 Начал играть на Uorpg.net


Top
   
 Post subject:
PostPosted: 2006-07-20 18:03:47 
Offline

Joined: 2004-05-16 16:23:27
Posts: 37
*sigh*

let's try this one more time. Again, i apologize for being unable to write this in russian, as i'm pretty sure that's the language barrier.

UO.hex2int gives an output of the form 0x0000.
I need an output just in the form of 0000.

Is there a way to format uo.hext2int so that it does not have 0x in front?


Top
   
 Post subject:
PostPosted: 2006-07-20 18:47:42 
Offline
Expert!
User avatar

Joined: 2005-09-14 15:31:58
Posts: 2152
Location: Latvia
Umuri wrote:
*sigh*

let's try this one more time. Again, i apologize for being unable to write this in russian, as i'm pretty sure that's the language barrier.

UO.hex2int gives an output of the form 0x0000.
I need an output just in the form of 0000.

Is there a way to format uo.hext2int so that it does not have 0x in front?


I guess you need som' mega expert help and btw why do you need such thing ? Yea' and I'm not pretty shure that its imposible :roll:

_________________
Уроки языка Injection
Основные команды языка Injection
Yoko Injection Code Sweeper
Drw (2009) скрипты
2017 Начал играть на Uorpg.net


Top
   
 Post subject:
PostPosted: 2006-07-20 19:34:25 
Offline

Joined: 2004-05-16 16:23:27
Posts: 37
I'm writing a program to catalogue all items in the shard.

UO.say(".add " + var)
where var is every number between 1 - 9999.
It then finds the item on the ground, pulls info from it which is sent to a text window, which another program i have pulls from and puts into a database.

Essentially just another way to make sure no items have slipped into the worldfile through bugs, except this oen can run during the night while i'm sleeping and then i can jsut compare the two databases the next day to see any changes.


Top
   
 Post subject:
PostPosted: 2006-07-20 20:13:21 
Offline
Expert!
User avatar

Joined: 2005-09-14 15:31:58
Posts: 2152
Location: Latvia
Umuri wrote:
I'm writing a program to catalogue all items in the shard.

UO.say(".add " + var)
where var is every number between 1 - 9999.
It then finds the item on the ground, pulls info from it which is sent to a text window, which another program i have pulls from and puts into a database.

Essentially just another way to make sure no items have slipped into the worldfile through bugs, except this oen can run during the night while i'm sleeping and then i can jsut compare the two databases the next day to see any changes.


very nice... I hope that the experts will help you or find another way to do it :roll:

_________________
Уроки языка Injection
Основные команды языка Injection
Yoko Injection Code Sweeper
Drw (2009) скрипты
2017 Начал играть на Uorpg.net


Top
   
 Post subject:
PostPosted: 2006-07-21 00:14:12 
Offline
User avatar

Joined: 2005-07-10 21:53:05
Posts: 457
0000 --> FFFF

Code:
for i=0 to 65535
UO.Say(".add " + UO.Int2Hex(i))
next


только таких админов нужно убивать рарной киркой на ББ :cry:


Top
   
 Post subject:
PostPosted: 2006-07-21 03:17:29 
Offline

Joined: 2004-05-16 16:23:27
Posts: 37
UO.Int2Hex(0) -> 0x000000
I need 0, or 000000.
UO.Int2Hex(1) -> 0x000001
I need 1, or 000001.

I need a way to do it, or a way to remove the 0x prefix.
Maybe if i write it in code it will help, since apparently the translation

000001 != 0x000001

I need 000001.


Top
   
 Post subject:
PostPosted: 2006-07-21 10:49:15 
Offline
Expert!
User avatar

Joined: 2004-04-04 11:13:54
Posts: 1205
Location: Балаково, Саратовская обл.
Code:
VAR hexnum
VAR num
num=Int2Hex(i)
hexnum=num[2]+num[3]+num[4]+num[5]


Top
   
 Post subject:
PostPosted: 2006-07-21 10:56:53 
Offline

Joined: 2004-05-16 16:23:27
Posts: 37
...... I feel stupid. I didn't even think to try standard char selection via array....


Thank you. Sorry for wasting your time on such a simple matter. *facepalm*


Top
   
 Post subject:
PostPosted: 2006-07-21 11:44:00 
Offline

Joined: 2004-05-16 16:23:27
Posts: 37
Thank you all for your help. I figure the least i can do is post the finished code for you all. I've scripted a few other staff/GM tools to help running a shard, and for catching cheaters. If there's any want i'll clean up/document those scripts and post them as well.

Also this is the first time i've written documented/clean code so any feedback would be lovely.

Code:
sub itemfinder()
VAR hexnum
VAR num
var i
var BackP = 0x4000D00E  # ID of your backpack, to cancel targetting
var itemName
var itemTemp
uo.textopen()
uo.textclear()
UO.DeleteJournal()
for i=1 to 65535
num = uo.Int2Hex(i)
hexnum=num[2]+num[3]+num[4]+num[5]
uo.waittargetobject(BackP)
UO.Say(".add " + hexnum)
UO.DeleteJournal()
while not UO.Injournal("would you like to place")
wait(100)
wend
wait(300) # included to cut down on spam filter
itemTemp = uo.journal(uo.injournal("would you like to place")-1)
itemName = mid(itemTemp,34,len(itemTemp)-35)
uo.textprint("Item Number " + hexnum + " is: " + itemName)
next


end sub


Top
   
 Post subject:
PostPosted: 2006-07-23 18:19:23 
Offline
Expert!
User avatar

Joined: 2005-09-14 15:31:58
Posts: 2152
Location: Latvia
Code:
uo.canceltarget()
:?:

_________________
Уроки языка Injection
Основные команды языка Injection
Yoko Injection Code Sweeper
Drw (2009) скрипты
2017 Начал играть на Uorpg.net


Top
   
 Post subject:
PostPosted: 2006-07-26 11:03:15 
Offline

Joined: 2004-05-16 16:23:27
Posts: 37
Tried using that, but it kept saying there was no targetting to cancel.

Btw, updated script. Also includes error handling for items that do not exist.
Code:
sub itemfinder()
VAR hexnum
VAR num
var i
var BackP = 0x4000D00E  # ID of your backpack, to cancel targetting
var itemName
var itemTemp
uo.textopen()
uo.textclear()
UO.DeleteJournal()
for i=1 to 65535
num = uo.Int2Hex(i)
hexnum=num[2]+num[3]+num[4]+num[5]
uo.waittargetobject(BackP)
UO.Say(".add " + hexnum)
UO.DeleteJournal()
while not UO.Injournal("would you like to place") and not UO.Injournal("a valid command")
wait(100)
wend
wait(300) # included to cut down on spam filter
if UO.Injournal("would you like to place") then
itemTemp = uo.journal(uo.injournal("would you like to place")-1)
itemName = mid(itemTemp,34,len(itemTemp)-35)
uo.textprint("Item Number " + hexnum + " is: " + itemName)
end if
if UO.Injournal("a valid command") then
uo.textprint("Item Number " + hexnum + " does not exist. ***********")
end if
next


end sub


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 17 posts ] 

All times are UTC+02:00


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Limited