Author Topic: Curseweapon script  (Read 5559 times)

0 Members and 1 Guest are viewing this topic.

Offline wreckdumbTopic starter

  • Newbie
  • *
  • Posts: 5
  • Activity:
    0%
  • Reputation Power: 0
  • wreckdumb has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Curseweapon script
« on: February 06, 2011, 10:11:12 PM »
0
hello, my goal here is to create a simple Curseweapon(CW) Timing script for my first script. what i wanna do now with this script is make a little menu with a CW count down. also i want the script to "read" when CW is recast so the timer can reset itself. please help with this.
all constructionism welcome since i know there mistakes. just no making fun of my first script =P

Code: [Select]
SET %NegativeCW 120    ; change this value 20 for every 1s you want to hear the Sound before Curse weapon expires.  100=5s
SET %Hotkey q          ; Change this to the key you wish to press to cast Curse weapon
;
;
;  No need to edit below here
;
keyloop:
onhotkey %Hotkey
gosub curseweapon

sub curseweapon
event macro 15 104 ; Cast Curse weapon
chooseskill Spir
set %SS ( #skill * 10 ) / 34 + 1
set %finaltime ( %SS * 2 ) - %NegativeCW
gosub Sound

sub sound  ; plays sound and message popup!
wait %finaltime
sound
wait 60
event ExMsg # 3 60 3...
wait 20
event ExMsg # 3 55 2...
wait 20
event ExMsg # 3 50 1...
wait 40
event ExMsg # 3 33 -=Curse Weapon Faded=-
return

if im doing anything wrong please tell me, so i can learn the right way the first time around!
« Last Edit: February 07, 2011, 08:57:07 AM by wreckdumb »

Scrripty

  • Guest
Re: Curseweapon script
« Reply #1 on: February 07, 2011, 08:57:57 AM »
0
All those waits are hurting you.  If I remember correctly Curse Weapon is karma based too right?  So you can't really use a strict timer to time Curse Weapon casting because your karma goes up and down.  What I would do, is make an editable timer on a menu.  One you can fine tune as the script is RUNNING.  So it's a variable wait instead of a hard coded wait.  Then if you happen to die, or take a murder count lets say, and your karma drops or raises, whatever the case may be, you can just edit the timer and poof, it casts on time again.  Now for menus, I suggest you goto www.easyuo.com and download the old version of easyuo and the menu designer.  Those are the easiest ways to create simple menus for new scripters. :)

Scrripty

  • Guest
Re: Curseweapon script
« Reply #2 on: February 07, 2011, 08:58:59 AM »
0
Also, you can check out my old version of PVM Dexer on this site to see some examples of ways to script timers for sampires.  There's a ton of good info in that script for you, you'll just have to dig through 3k+ lines to find it. :)

Offline 12TimesOver

  • Another Day, Another Vendetta
  • Global Moderator
  • *
  • *
  • Posts: 3694
  • Activity:
    0%
  • Reputation Power: 41
  • 12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.
  • Gender: Male
  • Respect: +321
  • Referrals: 2
    • View Profile
Re: Curseweapon script
« Reply #3 on: February 07, 2011, 10:01:40 AM »
0
Your loop is incomplete, if you're using a keyloop: tag you need a Goto in there to loop back:
Code: [Select]
keyloop:
onhotkey %Hotkey
gosub curseweapon
GOTO KEYLOOP

Alternatively you could ditch the goto and do something like:
Code: [Select]
repeat
     on hotkey %HotKey
          gosub curseweapon
until The_Cows_Come_Home

Still the same number of lines however you'll take no flack from the GoTo-Haters club ;)

X
When they come for me I'll be sitting at my desk
     with a gun in my hand wearing a bulletproof vest
My, my, my how the time does fly
     when you know you're gonna die by the end of the night

Offline Cerveza

  • Hacksimus Maximus
  • Scripthack
  • *
  • Posts: 5857
  • Activity:
    0%
  • Reputation Power: 80
  • Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!
  • Gender: Male
  • So... Hows that Hopey-Changey thing working out?
  • Respect: +403
  • Referrals: 11
    • View Profile
Re: Curseweapon script
« Reply #4 on: February 07, 2011, 10:10:19 AM »
0
Still the same number of lines however you'll take no flack from the GoTo-Haters club ;)

X

It's ironic that some of the supporters of GoTo also support OEUO, which doesn't support GoTo.
XXXXXXXXXX________________________________________] 20%
I've forgotten more about this game then most people will ever know.
Thank you for controlling your children. Their manners reflect your love for them.
Give a man a fish and you feed him for a day. Don't teach a man to fish, and you feed yourself. He's a grown man. Fishing's not that hard.

Offline 12TimesOver

  • Another Day, Another Vendetta
  • Global Moderator
  • *
  • *
  • Posts: 3694
  • Activity:
    0%
  • Reputation Power: 41
  • 12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.
  • Gender: Male
  • Respect: +321
  • Referrals: 2
    • View Profile
Re: Curseweapon script
« Reply #5 on: February 07, 2011, 10:20:52 AM »
0
Still the same number of lines however you'll take no flack from the GoTo-Haters club ;)

X

It's ironic that some of the supporters of GoTo also support OEUO, which doesn't support GoTo.
I'm not a member of that particular demographic myself although I'm a fan of using the tools you have at your disposal to get the job done in the most efficient way possible ;) Some toolboxes simply have different, and even better tools but the job will get done just the same...

X
When they come for me I'll be sitting at my desk
     with a gun in my hand wearing a bulletproof vest
My, my, my how the time does fly
     when you know you're gonna die by the end of the night

Scrripty

  • Guest
Re: Curseweapon script
« Reply #6 on: February 07, 2011, 10:21:57 AM »
0
Once you call a menu sub, you don't need to call it again. You'll have to experiment with it menus because it's too big of a topic to explain to you in a couple sentences. :)

Offline Cerveza

  • Hacksimus Maximus
  • Scripthack
  • *
  • Posts: 5857
  • Activity:
    0%
  • Reputation Power: 80
  • Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!
  • Gender: Male
  • So... Hows that Hopey-Changey thing working out?
  • Respect: +403
  • Referrals: 11
    • View Profile
Re: Curseweapon script
« Reply #7 on: February 07, 2011, 10:23:43 AM »
0
I wrote a tutorial to show how to make changes within a menu without having to reload the entire menu.

Just stroll over to the tutorials forum and you should be able to find it in there.... if not just post back and I'll look it up for you.
XXXXXXXXXX________________________________________] 20%
I've forgotten more about this game then most people will ever know.
Thank you for controlling your children. Their manners reflect your love for them.
Give a man a fish and you feed him for a day. Don't teach a man to fish, and you feed yourself. He's a grown man. Fishing's not that hard.

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13303
  • Activity:
    0.4%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Curseweapon script
« Reply #8 on: February 07, 2011, 10:28:55 AM »
0

It's ironic that some of the supporters of GoTo also support OEUO, which doesn't support GoTo.

Umm well my official bitches about Lua flow control have been lodged HERE  It's 1/2 thought through and makes for some wonky code when you want to short-circuit a loop your stuck in.
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline wreckdumbTopic starter

  • Newbie
  • *
  • Posts: 5
  • Activity:
    0%
  • Reputation Power: 0
  • wreckdumb has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Curseweapon script
« Reply #9 on: February 07, 2011, 10:29:11 AM »
0
I wrote a tutorial to show how to make changes within a menu without having to reload the entire menu.

Just stroll over to the tutorials forum and you should be able to find it in there.... if not just post back and I'll look it up for you.

dang posted 1 minute too late lol, ill check out your guide! ty

Offline 12TimesOver

  • Another Day, Another Vendetta
  • Global Moderator
  • *
  • *
  • Posts: 3694
  • Activity:
    0%
  • Reputation Power: 41
  • 12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.
  • Gender: Male
  • Respect: +321
  • Referrals: 2
    • View Profile
Re: Curseweapon script
« Reply #10 on: February 07, 2011, 10:30:33 AM »
0
Don't forget to include your RETURN's after every sub!! Do what I do, start every sub with:

Code: [Select]
Sub NameOfMySub

Return

THEN and ONLY THEN go back and fill out the space in between ;)

X

much appriciated guys!. ty for quick response!  now one more quick question.
should i be creating a sub to "update countdown" before i loop back to KEYLOOP?

Not totally sure I get the goal but if your countdown is to tell you when it's time to cast Curse Weapon again then you would flow through the countdown BEFORE returning back to your loop, maybe something like:

Code: [Select]
Gosub Displaymenu

repeat
     on hotkey %Hotkey
          gosub CastCurseWeapon
          gosub Countdown
until #FALSE

Sub CastCurseWeapon
     Event Macro Whatever
Return

Sub Countdown
     Do your countdown stuff
     Update menu
     Ring sound
Return
« Last Edit: February 07, 2011, 10:35:08 AM by 12TimesOver »
When they come for me I'll be sitting at my desk
     with a gun in my hand wearing a bulletproof vest
My, my, my how the time does fly
     when you know you're gonna die by the end of the night

Offline 12TimesOver

  • Another Day, Another Vendetta
  • Global Moderator
  • *
  • *
  • Posts: 3694
  • Activity:
    0%
  • Reputation Power: 41
  • 12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.
  • Gender: Male
  • Respect: +321
  • Referrals: 2
    • View Profile
Re: Curseweapon script
« Reply #11 on: February 07, 2011, 01:08:26 PM »
0
FYI - the use of:

Code: [Select]
Repeat

Until #FALSE

...is nothing more than a replacement for your "goto" loop. You don't want both.

The "Until #FALSE" is a criteria that will not be met thus the loop will run indefinitely. Goto's, when used correctly, are fine but they should never be used across subs. You should be able to get rid of your Keyloop: and goto Keyloop lines. Each Return will ALWAYS return back to the line following the line that called the sub. If you want to use your GOTO instead it would replace the Repeat Until #FALSE:

Code: [Select]
keyloop:
   onhotkey %CW_HOTKEY
      gosub curseweapon
      gosub updatetimer
goto keyloop

...is the same as...

Code: [Select]
Repeat
   onhotkey %CW_HOTKEY
      gosub curseweapon
      gosub updatetimer
Until #FALSE

X
When they come for me I'll be sitting at my desk
     with a gun in my hand wearing a bulletproof vest
My, my, my how the time does fly
     when you know you're gonna die by the end of the night

Offline wreckdumbTopic starter

  • Newbie
  • *
  • Posts: 5
  • Activity:
    0%
  • Reputation Power: 0
  • wreckdumb has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Curseweapon script
« Reply #12 on: February 07, 2011, 11:04:31 PM »
0
okay i got this script working exactly how i want it to run
just wanna make it visually better before i give it out to public

what i wanna do is when %Curseweap > 5 seconds  i want background font to be default black
and when %Curseweap <= 5 background to change to red.
 i tried doing this, but i dont know how to specify which control font to change.

after that its pretty much done. so please help finish up my first script!

Code: [Select]
;=================================================================
; Script Name: Curse Weapon Timer!
; Author: Wreckdumb and the rest of the kick ass team at scriptuo lol.
; Version: 1.0
; Shard OSI / FS: OSI / FS OK
; Revision Date: 2/8/2011
; Purpose: SMALL Menu Countdown timer for Curse weapon, and maybe more later on =P
; Globals: None
;=================================================================
; Special Instructions:
;
;
;
;--------------SETUP--------------
SET %CW_HOTKEY 9        ; Hotkey you wish to use to cast curseweapon
SET %CWTUNE 2           ; Adds 1s per 1,
;------------END SETUP------------
gosub CWMenu1
;
;
;
;
;
repeat
 onhotkey %CW_HOTKEY
  gosub curseweapon
  gosub updatetimer
  SET %Curseweap %CW - #SCNT
until #FALSE

sub curseweapon
  event macro 15 104 ; Cast Curse weapon
  chooseskill Spir   ;choose spirit speak
  SET %SS ( #skill * 10 ) / 34 + 1
  SET %CW #SCNT + %SS * 2 / 20 + %CWTUNE
  gosub updatetimer
return

sub updatetimer
if %Curseweap = 5     ; change this value to how many seconds before curse weapon ends for it to play sound.
sound
if %Curseweap <= 0
 menu set RECAST RECAST
 else
 menu set RECAST %Curseweap
return

;--------- EasyUO Menu Designer Code Begin ---------
sub CWMenu1
menu Clear
menu hideEUO
menu Window Title CW
menu Window Color Black
menu Window Size 113 14
menu Font Transparent #true
menu Font Align Right
menu Font Name MS Sans Serif
menu Font Size 8
menu Font Style
menu Font Color White
menu Font Transparent #false
menu Font Align Left
menu Font BGColor Black
menu Text Curseweapon 0 0 Curseweapon
menu Font Align Right
menu Font BGColor Red
menu Text RECAST 112 0 RECAST
menu Show 421 270
return
;--------- EasyUO Menu Designer Code End ---------

Tags: Curse weapon