Register forum user name Search FAQ

Gammon Forum

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 ➜ Stat Roller

Stat Roller

It is now over 60 days since the last post. This thread is closed.     Refresh page


Pages: 1  2 

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #15 on Sat 15 Feb 2003 10:49 PM (UTC)
Message
Quote:

It probably wouldn't hurt if aliases in mushclient accepted /{command} syntax and processed through the normal command interpreter (or at least the part that handles inline commands)


I'm worried about indefinite loops when you do that. eg.

Alias: X
Script: DoX

sub DoX (line, output, wildcards)

world.Interpret "X"

end sub

In this case the player types X which calls a script, the script does the (currently non-existent) Interpret function to pass the command X to the command interpreter, this calls the script, which then does X again, and so on, until the stack runs out.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Shadowfyr   USA  (1,790 posts)  Bio
Date Reply #16 on Sun 16 Feb 2003 07:32 PM (UTC)

Amended on Sun 16 Feb 2003 07:35 PM (UTC) by Shadowfyr

Message
Hmm.. Well that is a potential issue, but this is a programming language we are dealing with and last I checked it was up to the coder to avoid those things. It is no different than someone accidentally creating an infinite loop in a for next statement in a sub. Both will cause a problem. After all, these are all similar issues:

1. a regexp that you forget to escape [ and ] in.
2. loops in scripts that have invalid exit code.
3. Ctrl-Enter treating (at least in one case I know of) the seperate lines not as explicit data to go to the mud, but rather as though you used a command seperator.

Using a world.interpret command 'could' present a problem and I would tend to agree that it would be a bad thing. However, as something that is processed in the 'send' field of the actual alias and can be turned off, safeguards could also be set in place to prevent it calling itself. In theory..

You could even track such inline events so that each alias called got added to a list and if at any point the same alias name came up a dialog would appear to the effect that 'a recursive call was detected and processing of the alias {name here} was terminated.', along with an error window listing the names in the list and thus how the recursion happened. Since such internal calling would be disabled unless explicitly asked for, the overhead for normal aliases and triggers that didn't use the feature should be no more than the execution time of a single 'if then'.

Actually.. The same thing could be done through world.interpret, but unless it checked to see if each command was an alias before placing it in the list, you would have to track every command. However, since the point was to avoid having to duplicate the function of an alias by calling a scipt to handle the command, such a script side method is a bit silly.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #17 on Sun 16 Feb 2003 10:40 PM (UTC)
Message
Hmmm - and if the thing being interpreted was something that called another script, even something like this?

world.Interpret "/world.note blah"

This would require another instance of the script engine to be created. I'm not saying it couldn't be done, but I think there would be places where you would get unexpected behaviour. Already MUSHclient defers things like executing scripts on an alias or trigger by queing them. I can imagine a case where if there was a world.Interpret function, a week later I would get forum posts showing how things were being executed out of sequence.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Shadowfyr   USA  (1,790 posts)  Bio
Date Reply #18 on Mon 17 Feb 2003 06:21 AM (UTC)
Message
Hmm. I wasn't aware that internal commands did that. But again, as I said having a command that did that 'in' scripting makes no sense anyway. The only practical use is to directly execute an alias inside another alias or a trigger. If you are coding scripting anyway, then it is quite silly to not just use the commands you need directly. It is much easier to do 'world.note blah' than 'world.interpret "/world.note blah"'. Imho anyone dumb enough to try such deserves bugs. ;) lol

The only case anyone is really worried about is like:

alias: at *
send: attack %1

alias: fl *
send: flag %1
/setvariable "Mob", %1
at %1

The idea being to avoid what would require using a script, but frankly shouldn't. Some people think it is a bit nuts to 'require' scripting or multiple aliases/triggers just to set more than one variable as and example, or just to set one in the first place. This is the only instance where it is an issue.

Though.. Didn't you add direct setting using variable names of some sort into the actual trigger text? I seem to remember that you did or where going to, but if so then it certainly isn't in the normal help file ;) and I don't remember seeing it anyplace else in examples. If it does exist it is definitely an undocumented feature. lol
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #19 on Tue 18 Feb 2003 09:37 PM (UTC)
Message
The ability to set variables directly from an alias is something that is planned for the next version, I think Demonsurfer is hanging out for that one. :)

I think I considered doing what you said, but gave up because of the complexity and possible bugs.

I am looking into setting variables directly from an alias in the next day or so.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Guest1   USA  (256 posts)
Date Reply #20 on Tue 18 Feb 2003 10:24 PM (UTC)

Amended on Tue 18 Feb 2003 10:29 PM (UTC) by Guest1

Message
Quote:
I think Demonsurfer is hanging out for that one. :)

hehe yup :)

..oh, and a new field for variable name instead of using label so 2 triggers/aliases can send to the same variable without having to add a script for one of them. :)
Top

Posted by Guest1   USA  (256 posts)
Date Reply #21 on Fri 21 Feb 2003 08:34 PM (UTC)
Message
just a thought.. I guess you'll need to make the label the default (for send to variable) if the new variable field is blank, to allow for existing people's scripts..
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #22 on Fri 21 Feb 2003 09:37 PM (UTC)
Message
I think the simple solution would be to have another option:

"send to variable" where you then specify the variable name, as backwards compatibility is important.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Guest1   USA  (256 posts)
Date Reply #23 on Fri 21 Feb 2003 09:43 PM (UTC)

Amended on Sun 02 Mar 2003 12:17 AM (UTC) by Guest1

Message
that works too :)

how's it going?

--------

*sniff sniff* vers 3.33 far away?
Top

Posted by Ntmsz   (1 post)  Bio
Date Reply #24 on Fri 06 Jun 2003 09:47 PM (UTC)

Amended on Fri 06 Jun 2003 09:50 PM (UTC) by Ntmsz

Message
Hi, I have something much more simpler but I don't fully understand everything above, or have something quite different:


Strength: 14 (Hardy)
Dexterity: 14 (Nimble)
Constitution: 12 (Average)
Intelligence: 14 (Smart)
Wisdom: 15 (Thoughtful)
Charisma: 13 (Pretty)
Luck: 14 (Lucky)

I am experiencing this error message:
============================
There was a problem in script file "G:\Vault\Documents\Misc\OnStats.vbs":
==========================

Here is what I have come up with:

Trigger:
===============================================
^\s*(Strength|Dexterity|Constitution|Intelligence|Wisdom|Charisma|Luck)\s*(\d+) * $
===============================================

===============================================
Keep? (Y/N)
===============================================

OnStats:
===============================================
sub OnStats (strName, strLine, aryWildcards)

dim stat, start

' get stat (wildcards 1, 2)

stat = aryWildcards (1)
start = aryWildcards (2)

world.setvariable "stat_" & stat, start

end sub
==============================================

Thanks.
Top

Posted by Pow   USA  (1 post)  Bio
Date Reply #25 on Sun 12 Dec 2004 07:37 PM (UTC)

Amended on Sun 12 Dec 2004 09:52 PM (UTC) by Nick Gammon

Message
I really really need a stat roller for realms of kaos, if anyone could possibly help me out I would appreciate it tons!!!! My email is just_a_chic@hotmail.com and I have msn. Thank you a lot.

(edited to remove all caps)

Thank you, Pow!
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #26 on Sun 12 Dec 2004 07:53 PM (UTC)
Message
Ahem. You're in the wrong place, RoK isn't even a MUD, it has nothing to do with MUSHclient.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
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.


79,947 views.

This is page 2, subject is 2 pages long:  [Previous page]  1  2 

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.