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
➜ Half second timers
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1
2
3
Posted by
| David
USA (49 posts) Bio
|
Date
| Reply #30 on Wed 09 May 2001 02:11 AM (UTC) |
Message
| Hrm... I tried using the "" or the '' but this is a completely custom mud, it is not based on ANY MUD that I know of. it did not work
Its not ROM its not SMAUG, its not CIRCLE, its coded from scratch
I don't think there is the "" '' in it.
I got the code to do what i want, It splits the names into array's and uses the last one as the variable
What I want to do is make it a little tighter, instead of setting a varible for the first name "King", then "walking" to the next Array "Cold" and setting that variable as well.
I would prefere it to ignore all but the last array
and use that as the variable.
The split works, I just want to make it less cpu intensive... setting one varible instead of cycling through the names in the array's and setting multiple variables |
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,165 posts) Bio
Forum Administrator |
Date
| Reply #31 on Wed 09 May 2001 04:01 AM (UTC) |
Message
| I'm not sure why you need to go to this trouble. If the variable contains "Android 17" and you want to send:
throw Android 17 down
... then it will work without further modification. It isn't clear if the problem is getting "Android 17" into a single variable, or what. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| David
USA (49 posts) Bio
|
Date
| Reply #32 on Thu 10 May 2001 04:01 AM (UTC) |
Message
| Throw Android 17 down
That doesn't work
Throw "android 17" down
That doesn't work
It has to be a single word
throw android down
throw 17 down
This is what I am currently using to change my varible "attacker" to something that works
sub OnAttacker (Triggername, triggerline, arrWildCards)
Dim Sense
Sense = split (arrWildCards (1))
Dim i
for i=lbound (Sense ) to ubound (sense )
world.SetVariable "Attacker", sense (i)
next
End Sub
What I want to do is change this into seomthing like what we did with throw as the last command in the combo
Instead of setting 2 variables
the first being Android
and the second Being 17
I want it to ignore android and go straight to 17
|
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,165 posts) Bio
Forum Administrator |
Date
| Reply #33 on Thu 10 May 2001 05:05 AM (UTC) |
Message
| Ah, I see what you are doing now. :)
It is simpler than what you are doing. You don't need a loop just to get the last word in the list. Do this:
sub OnAttacker (Triggername, triggerline, arrWildCards)
Dim Sense
Sense = split (arrWildCards (1))
world.SetVariable "Attacker", sense (ubound (sense))
End Sub
The split will give you one or more words.
"Ubound (sense)" gives you the offset of the last word.
"sense (ubound (sense))" gives you the last word itself.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| David
USA (49 posts) Bio
|
Date
| Reply #34 on Thu 10 May 2001 09:27 AM (UTC) |
Message
| I knew there was a more simple way to do it...
Thanks.
A small side question however
Lets say I got a random set of charcter strings
rth slgjbgr gohu onaeog setgofnr
Ok random set of character strings..
I got the lbound, and the ubound part fine
What if i wanted to access something in the middle?
Is that possible to do?
How would you do so?
Also. another side thought.
I have this Trigger. I want it to run a script... Lets jsut say Autocombo for instance. However once it runs through the combo i get another Combination! ( * ) trigger, but the second Combination! ( * ) that I get, I want the script to act differently.
Is there a way to make the script create a new trigger, and timer to re-enable the old trigger, then run a different subroutine, from within the scrpt, to do something else, then go back to the original script?
____________________________________________________________
Ok this is a better way to put it I think. Its a map of what this thing is suposed to do
____________________________________________________________
Ok the first trigger is activated it-> runs a script to make a new trigger, and timer->Runs a "sub subroutine"(I.E. AutoCombo)-> The second Trigger comes-> Runs a differnet subroutine(IE autocombo)-> third trigger comes, Runs the same as the second-> the timer expires and changes the 2nd, and 3rd trigger, back to the first trigger, and completes the rest of the first script.
This is kinda confusing I am sure, but I think if you look at it, it does make sense in a wierd way
|
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,165 posts) Bio
Forum Administrator |
Date
| Reply #35 on Fri 11 May 2001 02:03 AM (UTC) |
Message
|
Quote:
I got the lbound, and the ubound part fine
What if i wanted to access something in the middle?
Is that possible to do?
Well, if ubound is 6 then the middle would be 3.
eg.
blah = split ("rth slgjbgr gohu onaeog setgofnr")
world.note blah (ubound (blah) / 2)
This would show the word half-way through that list of words.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Nick Gammon
Australia (23,165 posts) Bio
Forum Administrator |
Date
| Reply #36 on Fri 11 May 2001 02:14 AM (UTC) Amended on Fri 11 May 2001 02:15 AM (UTC) by Nick Gammon
|
Message
|
Quote:
Ok the first trigger is activated it-> runs a script to make a new trigger, and timer->Runs a "sub subroutine"(I.E. AutoCombo)-> The second Trigger comes-> Runs a differnet subroutine(IE autocombo)-> third trigger comes, Runs the same as the second
You confuse me a bit by talking about two subroutines both called Autocombo (as VB is not case-sensitive) however, you can probably achieve what you are doing by having a flag which you test in the trigger.
Something like this:
sub OnTrigger (Triggername, triggerline, arrWildCards)
dim flag
flag = world.getvariable ("flag")
if flag = "b" then
' ..... do something here (action B) .....
else
' ..... do something different here (action A) .....
world.setvariable "flag", "b"
world.AddTimer ("blahblah", 0, 0, 5, "", 1029, "On_Fix_Trigger");
end if
end sub
sub On_Fix_Trigger (strTimerName)
world.setvariable "flag", "a"
end sub
What you have here is a single trigger that does action A or action B depending on the flag. Initially the flag will be "a" (or empty) so action A is done. In this case we set the flag to "b" so the action B is done next time around, and set up a 5-second timer to change the flag back at the end of the 5 seconds.
The other sub is called by the timer to switch the flag back.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| David
USA (49 posts) Bio
|
Date
| Reply #37 on Tue 15 May 2001 05:03 AM (UTC) |
Message
| Okies.
When your creating a new character, I want to set a varible for the race that you select
Let me show you the code that I am trying to do, maybe you will know what I am doing wrong
sub OnRace (Triggername, triggerline, arrWildCards)
world.setvariable "Race", arrWildCards (1)
dim flag
flag = world.getvariable ("Race")
if flag = "saiyan|human|namek|android" then
world.setvariable "Race", arrWildCards (1)
world.send arrWildCards (1)
else
world.note "That is an invalid Race selection, Please check spelling and capitalization (hint, Don't capitilize your race)"
end if
end sub
I guess the question is I need the race to be case sensitive The only way I can see how to do this is at character creation
How do I create an "or" statement in the script.
if flag = "any of these possibilities" then
do this
else
world.note "Try again type this"
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 |
|
Posted by
| David
USA (49 posts) Bio
|
Date
| Reply #38 on Tue 15 May 2001 07:07 AM (UTC) |
Message
| Ok, again, I wasted time with posting, I ended up using elseif statement
It works, but I can not seem to get an alias added from within the script
This is what I am doing, it is giving me an errorsub OnRace (Triggername, triggerline, arrWildCards)
world.SetVariable "Race", arrWildCards (1)
dim flag
flag = world.getvariable ("Race")
if flag = "saiyan" then
world.setvariable "Race", arrWildCards (1)
world.send arrWildCards (1)
world.note "Your have selected: " + world.getvariable ("Race")
world.deletealias "RaceSelection"
world.setVariable "Kaioken", "off"
World.addalias "Kaioken", "kk", "", "", 1+32, "OnKaioken"
elseif flag= "human" then
elseif flag= "namek" then
elseif flag= "android" then
else
world.note "That is an invalid Race selection, Please check spelling and capitalization (hint, Don't capitilize your race)"
end if
end sub
Anyways,
This part isn't working, Why?
World.addalias "Kaioken", "kk", "", "", 1+32, "OnKaioken"
|
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,165 posts) Bio
Forum Administrator |
Date
| Reply #39 on Tue 15 May 2001 09:54 AM (UTC) |
Message
| The prototype for AddAlias is:
long AddAlias(BSTR AliasName, BSTR MatchText, BSTR ResponseText, long Flags, BSTR ScriptName);
You have specified:
World.addalias "Kaioken", "kk", "", "", 1+32, "OnKaioken"
You have supplied 6 arguments whereas AddAlias takes 5. That is your problem.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Nick Gammon
Australia (23,165 posts) Bio
Forum Administrator |
Date
| Reply #40 on Fri 24 Dec 2004 03:55 AM (UTC) |
Message
|
Quote:
I need a timer that A. waits 1.5 seconds before sending something to the world ...
Version 3.61 onwards now implements sub-second timers. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | 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.
105,427 views.
This is page 3, subject is 3 pages long:
1
2
3
It is now over 60 days since the last post. This thread is closed.
Refresh page
top