|
brood Newbie
Joined: 08 Aug 2006 Posts: 4
|
Posted: Tue Aug 08, 2006 6:40 am
from jmc to zmud |
i need rewrite with jmc script in zmud
function tel(who,what)
{
var i = what.indexOf(who)
var out = what.substring(i+who.length, what.length)
jmc.send("tell" + who + " &W†&RIlm&W† " + drawstr(out));
}
function drawstr(what)
{
var work = what+" "
what = what+" "
var out = ""
var cnt = count(what," ")
for(var i = 0; i < cnt; i++)
{
var epos = work.indexOf(" ")
var temp = work.substr(0, epos)
work = work.substr(epos+1, work.length)
if(temp.length != 0)
out += " &z"+temp.substr(0,1)+"&W"+temp.substr(1,temp.length)
}
return out;
}
// Count Occurances of a Substring
function count(aString, aSubstring)
{
// initialize counter and offset
var count = 0
var offset = 0
var where = 0
var tmp = ""+aString
// search until no more found
while ((offset < tmp.length) &&
((where = tmp.indexOf(aSubstring, offset)) >= 0))
{
count++
offset = where+aSubstring.length
}
// return it
return count
}
function whisp(who1,what1)
{
var i1 = what1.indexOf(who1)
var out1 = what1.substring(i1+who1.length, what1.length)
jmc.send("whisper" + who1 + " &W†&RIlm&W† " + drawstr(out1));
}
function gtell(what2)
{
var i2 = what2.indexOf
var out2 = what2.substring(i2, what2.length)
jmc.send("ordertalk" + " &W†&RIlm&W† " + drawstr(out2));
}
function ooc(what3)
{
var i3 = what3.indexOf
var out3 = what3.substring(i3, what3.length)
jmc.send("ooc" + drawstr(out3));
}
function chat(what4)
{
var i4 = what4.indexOf
var out4 = what4.substring(i4, what4.length)
jmc.send(". " + drawstr(out4));
}
function ask(what5)
{
var i5 = what5.indexOf
var out5 = what5.substring(i5, what5.length)
jmc.send("ask" + drawstr(out5));
}
function answer(what6)
{
var i6 = what6.indexOf
var out6 = what6.substring(i6, what6.length)
jmc.send("answ" + drawstr(out6));
}
function yell(what7)
{
var i7 = what7.indexOf
var out7 = what7.substring(i7, what7.length)
jmc.send("yel" + drawstr(out7));
}
function shout(what8)
{
var i8 = what8.indexOf
var out8 = what8.substring(i8, what8.length)
jmc.send("shou" + drawstr(out8));
}
function music(what9)
{
var i9 = what9.indexOf
var out9 = what9.substring(i9, what9.length)
jmc.send("mus" + drawstr(out9));
}
function reply(what10)
{
var i10 = what10.indexOf
var out10 = what10.substring(i10, what10.length)
jmc.send("repl" + " &W†&RIlm&W† " + drawstr(out10));
}
function speak(what11)
{
var i11 = what11.indexOf
var out11 = what11.substring(i11, what11.length)
jmc.send("say" + " &W†&RIlm&W† " + drawstr(out11));
}
function play (str) {
var WShell = new ActiveXObject ( "WScript.Shell" ) ;
WShell.Run ( "MPLAY32 /play /close sound\"+str+".wav", 0 ) ;
}
function DIV_hp()
{
var inthp;
inthp = jmc.GetVar("youhp") / jmc.GetVar("allhp")
inthp = inthp * 100
inthp = Math.round(inthp);
jmc.SetVar("deltahp", inthp)
} |
|
|
|
edb6377 Magician
Joined: 29 Nov 2005 Posts: 482
|
Posted: Tue Aug 08, 2006 7:49 am |
Okay well heres what i think you should look at. Realize these are extremely simple forms of the commands. You could certainly expand them to more complex settings.
function tel(who,what)
is similar to #ALIAS command with it using %1 as who and %2 as what.
#ALIAS TEL {tell %1 &W†&RIlm&W† %2}
Least thats how i understand it. You posted no examples of the commands in action
var is #VAR
i..e
#VAR inthp {inthp*100}
Might be easier to decide what exactly you want a script to do and design it that way. |
|
_________________ Confucious say "Bugs in Programs need Hammer" |
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Tue Aug 08, 2006 2:30 pm |
JMC scripts are JavaScript with or without JMC directives in them. Searching for JMC should throw up a translation of a JMC script I did a few months ago. Reading said script translation should help you with translating the JMC directives into zMUD directives so you can translate your script.
|
|
_________________ Taz :) |
|
|
|
brood Newbie
Joined: 08 Aug 2006 Posts: 4
|
Posted: Wed Aug 09, 2006 6:59 am |
I want colored chat
For example,
--------------------------------------------
#VAR out ""
#VAR Scheme "Gggz" // Change this string for your different colors
#VAR ESC "&" // escape charecter the mud uses the ansii colors
#VAR Count 0
#WHILE ( %len( "%-1")>=@Count) {
#VAR out %concat( @out, @ESC)
#VAR t %copy( @Scheme, %mod( @Count, %len( @Scheme))+1, 1)
#IF ( @t = %upper( @t) ) {#VAR out %concat( @out, "i|")}{#VAR out %concat( @out, "n|")}
#VAR out %concat( @out, @t)
#VAR out %concat( @out, %copy( "%-1", @Count+1, 1))
#ADD Count 1
}
#VAR out %concat( @out, @ESC, "g")
racetalk @out
--------------------------------------------
but that color is not randomized: fierst and last letter of each word have the same color (not for me but in mud server)
You tell Ilm'(*Brood*) Hi Word1 Word2 ... Word11 ... ' |
|
Last edited by brood on Wed Aug 09, 2006 9:56 am; edited 3 times in total |
|
|
|
edb6377 Magician
Joined: 29 Nov 2005 Posts: 482
|
Posted: Wed Aug 09, 2006 9:17 am |
#var tags {(|B)|(|R)|(|C)|(|M)|(|Y)|(|W)|(|G)|(|b)|(|r)|(|c)|(|m)|(|y)|(|w)|(|g)|(|D)|(|X)|(|I)}
#alias {rt} {
#var args "";
#loop %numparam() {#var args @args" "%param(%i)};
#var args %trim(@args);
racetalk %item(@tags,%random(1,%numitems(@tags)))@args|Y;
#abort;
}
is what i use the #VAR tags is the ansi colors on my mud. i changed the alias name to RT and racetalk for your uses although i use clantalk. I am sure you could also use a rand command for it |
|
_________________ Confucious say "Bugs in Programs need Hammer" |
|
|
|
brood Newbie
Joined: 08 Aug 2006 Posts: 4
|
Posted: Wed Aug 16, 2006 12:54 pm |
the problem partially resolved by this
#alias {ot} {
#MATH temp1 (%len( " "))
#MATH temp2 (@temp1)+1
#MATH temp3 (@temp2)+1
#var what %concat( "&z", %copy( %0, @temp1, 1), "&G", %copy( %0, @temp2, 1), "&g", %copy( %0, @temp3, %len( %0)), "&C")
#send %concat( "ordertalk", " ", "&z(&Y¤&GÑ&gìå&zê&gòè&GÊ&Y¤&z)&g", " ", @what)
}
or
#alias {tl} {
#var who %copy( %0, 0, %len( %1))
#MATH temp1 (%len( "%1"))+(%len( " "))
#MATH temp2 (@temp1)+2
#MATH temp3 (@temp2)+1
#var what %concat( "&z", %copy( %0, @temp1, 2), "&G", %copy( %0, @temp2, 1), "&g", %copy( %0, @temp3, %len( %0)), "&C")
#send %concat( "tell", " ", @who, " ", "&z(&Y¤&GÑ&gìå&zê&gòè&GÊ&Y¤&z)&g", @what)
}
but zmud don't understand symbol ',' when using this scripts
for exaple
tl brood Hi, word1 word2
and
tl brood Hi word1 word2
worked differently |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Wed Aug 16, 2006 11:34 pm |
Minor rewrite to make things better:
#alias {tl} {
#VAR what {%concat( "&z", %copy( "%-2", 1, 2), "&G", %copy( "%-2", 3, 1), "&g", %copy( "%-2", 4, 255), "&C")}
#SEND {%concat( "tell ", %1, " ", "&z(&Y¤&GÑ&gìå&zê&gòè&GÊ&Y¤&z)&g", @what)}
}
The only caveat to this is that I enclosed the references for %-2 in quotes. This is necessary with zMud, but will cause problems in the future when CMud becomes public. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
brood Newbie
Joined: 08 Aug 2006 Posts: 4
|
Posted: Thu Aug 17, 2006 7:33 am |
Thanks, Vijilante, this that that is necessary.
I a little modified because IAC problem (double russian word ß this is symbol with cod 255)
#alias {tl} {
#VAR what {%concat( "&z", %copy( "%-2", 1, 2), "&G", %copy( "%-2", 3, 1), "&g", %copy( "%-2", 4, 255), "&C")}
%concat( "tell ", %1, " ", "&z(&Y¤&GÑ&gìå&zê&gòè&GÊ&Y¤&z)&g", @what)
+
#ONINPUT {ÿ} {#SUBSTITUTE ß} "" {nocr|case|verbatim}{}
#ONINPUT {ß} {#SUBSTITUTE ß} "" {nocr|case|verbatim}{}
#TRIGGER {ß} {#sub ÿ} {case}
adn OK |
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|