ScriptUO

Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: VicVega on May 26, 2009, 10:41:51 AM

Title: Problems with Skill Gaining calculator script
Post by: VicVega on May 26, 2009, 10:41:51 AM
So this is a script I've made in order to know how much time left for reaching GM status and how much skill points per hour are gained.

The idea it's to execute it in other tab different from the main script.

But I don't know exactly why, after a while the UO ends crashing and I have to close it after a time using the script.

Hope someone finds wich could be the problem.

Code: [Select]
;=================================================================
; Script Name: Skill Gaining Calculator
; Author: VicVega
; Version: 0.1
; Shard OSI / FS: UO Legends
; Revision Date: 26/5/2009
; Purpose: Shows in the UO title bar the skill per hour points you are gaining
;          Also shows the time left to achieve GM level
; Globals: None
;=================================================================
; Instructions: Set the skill you want to check in %skill variable
;************************ Setup **********************************
gosub setup
;*********************** Main Loop *******************************
repeat
  set %skillGained #skill - %startingSkill
  set %timePassed #scnt - %startingTime
  set %skillPerHour ( 3600 * %skillGained ) / %timePassed
  gosub timeLeftToGM
  setuotitle S/H: %skillPerHour GM: %timeLeftToGM S: %skillGained T: %timePassed
  wait 10s
until #charGhost = yes
;************************* Subs **********************************
sub setup
    set %skill anim
    chooseskill %skill
    set %startingSkill #skill
    set %startingTime #scnt
return

sub timeLeftToGM
  if %skillGained > 0
  {
     set %timeLeftToGMSecs ( ( 1000 - #skill ) * %timePassed ) / %skillGained
     gosub ConvertTimeHourMinSec %timeLeftToGMSecs
     set %timeLeftToGM #strres
  }
return

; %1 = input - Time to convert
; #RESULT -  Time converted to H:MM:SS format
sub ConvertTimeHourMinSec
  namespace push
  namespace local ctime
  set !hourpart %1 / 3600
  set !secpart ( %1 % 3600 ) % 60
  set !minpart ( ( %1 % 3600 ) / 60 )

  if !hourpart >= 10
    set #STRRES !hourpart , :
  else
    set #STRRES 0 , !hourpart , :
  if !minpart < 10
    set #STRRES #STRRES , 0
  set #STRRES #STRRES , !minpart , :
  if !secpart < 10
    set #STRRES #STRRES , 0
  set #STRRES #STRRES , !secpart
  namespace pop
return
Title: Re: Problems with Skill Gaining calculator script
Post by: TrailMyx on May 26, 2009, 11:20:20 PM
Hi Vic, sorry I'm at Disneyland right now, but still want to take a look at this.  I'll have a bit more time Wednesday night, but right now I'm at the hotel here in DLand.
Title: Re: Problems with Skill Gaining calculator script
Post by: Masscre on May 27, 2009, 12:53:32 PM
Go play forget about the code for a little while have some fun with the family :)
Title: Re: Problems with Skill Gaining calculator script
Post by: VicVega on May 27, 2009, 11:50:42 PM
I agree, also punch Mickey in the face for me if you have the ocassion, always wanted to do it.  ;D

Look out, he is swinging his arm!

(http://3.bp.blogspot.com/_PVy6_J7_Qdw/SSNFsFAdGzI/AAAAAAAABa4/hwYzuXXciPI/s400/mickey-mouse.jpg)
Title: Re: Problems with Skill Gaining calculator script
Post by: Cerveza on May 28, 2009, 05:16:14 AM
I pay top dollar for pictures of Minnie.