Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ All right... Why doesn't this work?
|
All right... Why doesn't this work?
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| David B
USA (80 posts) Bio
|
| Date
| Fri 29 Aug 2003 10:00 PM (UTC) Amended on Fri 29 Aug 2003 10:01 PM (UTC) by David B
|
| Message
| dim XPOLD, XPNEW, XPDIFF
world.setvariable "XPNEW", "%1"
XPOLD = CInt(world.getvariable ("XPOLD"))
XPNEW = CInt(world.getvariable ("XPNEW"))
XPDIFF = (XPOLD - XPNEW)
if XPDIFF < 0 then
XPDIFF = (XPDIFF + 100)
elseif XPDIFF = 0 then
exit sub
end if
world.setvariable ("XPOLD"), XPNEW
world.setvariable "XPDIFF", XPDIFF
world.enabletrigger "XP", FALSE
This of course is a trigger that is sent to script...
It doesn't work, Why? Can you make it so that it does work in the future?
As you know from my recent posts I'm writting an infobar script for the mud I play, Right now its only checking the prompt when I kill a creature, I'd like to have it check on EVERY prompt, but if the difference is 0 I want it to ignore the rest of the script. I take it that this is one of those few things that just can't be done in this fashion.
|
My code(with a LOT of Nicks help) to fame:
sub OnAutoCombo (TriggerName, TriggerLine, arrWildCards)
dim AutoCombo
AutoCombo = split (arrWildCards (1))
Dim i, attack
for i=lbound (AutoCombo ) to ubound (AutoCombo )
Select Case AutoCombo (i)
case "rp" attack = "punch right"
case "lp" attack = "punch left"
case "s" attack = "sweep"
case "r" attack = "roundhouse"
case else attack = "" ' unknown attack type
End Select
if i = ubound (AutoCombo ) then
world.send "throw " + world.getvariable ("attacker") + " down"
else
world.send attack + " " + world.GetVariable ("attacker")
end if
next
end sub
| | Top |
|
| Posted by
| Shadowfyr
USA (1,792 posts) Bio
|
| Date
| Reply #1 on Fri 29 Aug 2003 10:17 PM (UTC) |
| Message
| Umm. One good guess would be this line:
world.setvariable ("XPOLD"), XPNEW
You don't need the () and I am actually surprised you don't get an error of some kind. If it is some other issue, then I have no idea. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #2 on Fri 29 Aug 2003 10:36 PM (UTC) |
| Message
| There are two ways you could re-work this. One is to rejig the "if", like this:
dim XPOLD, XPNEW, XPDIFF
world.setvariable "XPNEW", "%1"
XPOLD = CInt(world.getvariable ("XPOLD"))
XPNEW = CInt(world.getvariable ("XPNEW"))
XPDIFF = (XPOLD - XPNEW)
if XPDIFF < 0 then
XPDIFF = (XPDIFF + 100)
elseif XPDIFF > 0 then
world.setvariable ("XPOLD"), XPNEW
world.setvariable "XPDIFF", XPDIFF
world.enabletrigger "XP", FALSE
end if
The other is to put it into a sub after all, like was discussed here recently, eg.
sub mytrigger
dim XPOLD, XPNEW, XPDIFF
world.setvariable "XPNEW", "%1"
XPOLD = CInt(world.getvariable ("XPOLD"))
XPNEW = CInt(world.getvariable ("XPNEW"))
XPDIFF = (XPOLD - XPNEW)
if XPDIFF < 0 then
XPDIFF = (XPDIFF + 100)
elseif XPDIFF = 0 then
exit sub
end if
world.setvariable ("XPOLD"), XPNEW
world.setvariable "XPDIFF", XPDIFF
world.enabletrigger "XP", FALSE
end sub
call mytrigger
That way you can "exit sub" because you have put it into one.
However the first approach is probably simpler.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| David B
USA (80 posts) Bio
|
| Date
| Reply #3 on Fri 29 Aug 2003 10:51 PM (UTC) |
| Message
| Thanks Nick the first one worked like a charm.
As for the whole ("VARIABLE") thing, I don't know, it works fine still. I fixed it just in case.
Finished Project:
world.infoclear
world.InfoFont "Arial", 13, 1
world.setvariable "EXPTOLEVEL", "%1"
world.setvariable "XPNEW", "%1"
dim EXPTICK, TICK, TICKERNEW, TICKERBLANK, EXPTOLEVEL, EXPFROMLEVEL, count
dim XPOLD, XPNEW, XPDIFF
XPOLD = CInt(world.getvariable ("XPOLD"))
XPNEW = CInt(world.getvariable ("XPNEW"))
XPDIFF = (XPOLD - XPNEW)
if XPDIFF < 0 then
XPDIFF = (XPDIFF + 100)
elseif XPDIFF > 0 then
world.setvariable "XPOLD", XPNEW
world.setvariable "XPDIFF", XPDIFF
world.enabletrigger "XP", FALSE
end if
EXPTOLEVEL = CInt(world.getvariable ("EXPTOLEVEL"))
EXPFROMLEVEL = (100 - EXPTOLEVEL)
world.setvariable "EXPFROMLEVEL", EXPFROMLEVEL
TICKERNEW = " "
TICKERBLANK = ""
TICK = "|"
EXPTICK = ""
for count = 1 to CInt(world.getvariable ("EXPFROMLEVEL"))
TICKERBLANK = (TICKERBLANK + TICKERNEW)
next
for count = 1 to CInt(world.getvariable ("EXPTOLEVEL"))
EXPTICK = (EXPTICK + TICK)
next
world.infoclear
world.InfoBackground "black"
world.InfoFont "Arial", 13, 1
world.infocolour "white"
world.info "Experience to Level ["
world.InfoColour "red"
world.info EXPTICK
world.info TICKERBLANK
world.InfoColour "white"
world.info "] ("
world.infocolour "yellow"
world.info world.getvariable ("EXPTOLEVEL")
world.infocolour "white"
world.info "%) Last Gained ("
world.infocolour "yellow"
world.info world.getvariable ("XPDIFF")
world.infocolour "white"
world.info "%)"
You guys have helped a lot.
More thanks to Nick for his Excellent Help files... Without them I'd have never been able to do this. |
My code(with a LOT of Nicks help) to fame:
sub OnAutoCombo (TriggerName, TriggerLine, arrWildCards)
dim AutoCombo
AutoCombo = split (arrWildCards (1))
Dim i, attack
for i=lbound (AutoCombo ) to ubound (AutoCombo )
Select Case AutoCombo (i)
case "rp" attack = "punch right"
case "lp" attack = "punch left"
case "s" attack = "sweep"
case "r" attack = "roundhouse"
case else attack = "" ' unknown attack type
End Select
if i = ubound (AutoCombo ) then
world.send "throw " + world.getvariable ("attacker") + " down"
else
world.send attack + " " + world.GetVariable ("attacker")
end if
next
end sub
| | Top |
|
| Posted by
| David B
USA (80 posts) Bio
|
| Date
| Reply #4 on Fri 29 Aug 2003 10:56 PM (UTC) |
| Message
| Can you have Multiple lines on the Infobar?
Right now I have 1 line of Text.
Is it possible to put 2 lines, one on top of the other?
Experience |||||||||||||||||||
Hit Points |||||||||||||||
|
My code(with a LOT of Nicks help) to fame:
sub OnAutoCombo (TriggerName, TriggerLine, arrWildCards)
dim AutoCombo
AutoCombo = split (arrWildCards (1))
Dim i, attack
for i=lbound (AutoCombo ) to ubound (AutoCombo )
Select Case AutoCombo (i)
case "rp" attack = "punch right"
case "lp" attack = "punch left"
case "s" attack = "sweep"
case "r" attack = "roundhouse"
case else attack = "" ' unknown attack type
End Select
if i = ubound (AutoCombo ) then
world.send "throw " + world.getvariable ("attacker") + " down"
else
world.send attack + " " + world.GetVariable ("attacker")
end if
next
end sub
| | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #5 on Fri 29 Aug 2003 11:13 PM (UTC) |
| Message
| |
| Posted by
| David B
USA (80 posts) Bio
|
| Date
| Reply #6 on Sat 30 Aug 2003 02:43 AM (UTC) |
| Message
| This should work, but it doesn't, Why?
world.infoclear
world.InfoBackground "black"
world.InfoFont "Arial", 12, 1
world.infocolour "white"
world.info "Experience To Level ["
if CInt(world.getvariable ("EXPTOLEVEL")) < 75 then
world.InfoColour "orange"
world.info EXPTICK
elseif CInt(world.getvariable ("EXPTOLEVEL")) < 50 then
world.InfoColour "yellow"
world.info EXPTICK
elseif CInt(world.getvariable ("EXPTOLEVEL")) < 10 then
world.InfoColour "red"
world.info EXPTICK
else
world.infocolour "blue"
world.info EXPTICK
end if
world.info TICKERBLANK
world.InfoColour "white"
world.info "] ("
world.infocolour "yellow"
world.info world.getvariable ("EXPTOLEVEL")
world.infocolour "white"
world.info "%) Last Gained ("
world.infocolour "yellow"
world.info world.getvariable ("XPDIFF")
world.infocolour "white"
world.info "%) Current Level: "
world.infocolour "yellow"
world.info world.getvariable ("Level")
Thanks for the help |
My code(with a LOT of Nicks help) to fame:
sub OnAutoCombo (TriggerName, TriggerLine, arrWildCards)
dim AutoCombo
AutoCombo = split (arrWildCards (1))
Dim i, attack
for i=lbound (AutoCombo ) to ubound (AutoCombo )
Select Case AutoCombo (i)
case "rp" attack = "punch right"
case "lp" attack = "punch left"
case "s" attack = "sweep"
case "r" attack = "roundhouse"
case else attack = "" ' unknown attack type
End Select
if i = ubound (AutoCombo ) then
world.send "throw " + world.getvariable ("attacker") + " down"
else
world.send attack + " " + world.GetVariable ("attacker")
end if
next
end sub
| | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #7 on Sat 30 Aug 2003 02:57 AM (UTC) |
| Message
| | Can you say in what way it doesn't work? Syntax error? If so, what and at what line? Something else? Please specify. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| David B
USA (80 posts) Bio
|
| Date
| Reply #8 on Sat 30 Aug 2003 03:27 AM (UTC) |
| Message
| if CInt(world.getvariable ("EXPTOLEVEL")) < 75 then
world.InfoColour "orange"
world.info EXPTICK
elseif CInt(world.getvariable ("EXPTOLEVEL")) < 50 then
world.InfoColour "yellow"
world.info EXPTICK
elseif CInt(world.getvariable ("EXPTOLEVEL")) < 10 then
world.InfoColour "red"
world.info EXPTICK
else
world.infocolour "blue"
world.info EXPTICK
end if
It wouldn't cascade the way I wanted it too... I ended up figuring out that I had to reverse the order. so that it went 10, 25, 50, 75. Instead of 75, 50, 25, 10....
It didn't cross my mind at first to do it in reverse order.
50 is still less than 75 so it never checked 50 or 25 or 10.
My next issue here is this snippet:
dim levelold, level
levelold = CInt(world.getvariable ("level"))
level = (levelold + 1)
world.setvariable "level", level
That works fine and dandy, but once you go past level 100 you become a hero, and there is hero levels. Hero Level 1, 2, 3.... Up till hero level 750
Yes, a total of 850 levels or so... Once I hit 100 I'd like it to be able to say in the info bar Level: H1, H2, H3...
I hope that explains why that code didn't work, and I hope you can help me figure out how to make it so that this can count Hero levels. |
My code(with a LOT of Nicks help) to fame:
sub OnAutoCombo (TriggerName, TriggerLine, arrWildCards)
dim AutoCombo
AutoCombo = split (arrWildCards (1))
Dim i, attack
for i=lbound (AutoCombo ) to ubound (AutoCombo )
Select Case AutoCombo (i)
case "rp" attack = "punch right"
case "lp" attack = "punch left"
case "s" attack = "sweep"
case "r" attack = "roundhouse"
case else attack = "" ' unknown attack type
End Select
if i = ubound (AutoCombo ) then
world.send "throw " + world.getvariable ("attacker") + " down"
else
world.send attack + " " + world.GetVariable ("attacker")
end if
next
end sub
| | Top |
|
| Posted by
| David B
USA (80 posts) Bio
|
| Date
| Reply #9 on Sat 30 Aug 2003 04:17 AM (UTC) |
| Message
| Never mind my last post, after talking to someone who codes He helped me figure it out:
dim levelold, level
levelold = CInt(world.getvariable ("level"))
if world.getvariable ("level2") = "subhero" then
level = (levelold + 1)
if level > 100 then
world.setvariable "level2", "H"
level = (level - 100)
world.setvariable "level", level
else
world.setvariable "level", level
end if
else
level = (levelold + 1)
world.setvariable "level", level
end if
|
My code(with a LOT of Nicks help) to fame:
sub OnAutoCombo (TriggerName, TriggerLine, arrWildCards)
dim AutoCombo
AutoCombo = split (arrWildCards (1))
Dim i, attack
for i=lbound (AutoCombo ) to ubound (AutoCombo )
Select Case AutoCombo (i)
case "rp" attack = "punch right"
case "lp" attack = "punch left"
case "s" attack = "sweep"
case "r" attack = "roundhouse"
case else attack = "" ' unknown attack type
End Select
if i = ubound (AutoCombo ) then
world.send "throw " + world.getvariable ("attacker") + " down"
else
world.send attack + " " + world.GetVariable ("attacker")
end if
next
end sub
| | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
32,537 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top