TinTin++ Mud Client The TinTin++ message board

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
TinTin++ Mud Client

multiple tintin commands in a string?

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> General Discussion
View previous topic :: View next topic  
Author Message
techman246



Joined: 27 May 2013
Posts: 46

PostPosted: Mon Oct 07, 2013 4:36 pm    Post subject: multiple tintin commands in a string? Reply with quote

how would I go about stringing together multiple commands inside of an action?
Back to top
View user's profile Send private message
moire



Joined: 29 Jan 2012
Posts: 24

PostPosted: Mon Oct 07, 2013 5:35 pm    Post subject: Reply with quote

You could look at the scripts.
Back to top
View user's profile Send private message
ixle



Joined: 15 Sep 2011
Posts: 158
Location: United States

PostPosted: Tue Oct 08, 2013 3:07 pm    Post subject: Reply with quote

Code:
#action {some pattern} {do thing 1;do thing 2;do thing 3}


or for increased readability:

Code:
#action {some pattern}
{
    do thing 1;
    do thing 2;
    do thing 3;
}
Back to top
View user's profile Send private message
techman246



Joined: 27 May 2013
Posts: 46

PostPosted: Tue Oct 08, 2013 6:04 pm    Post subject: text In a variable Reply with quote

How would I echo the line that triggered the #action into a variable?

Example:
#action {some text}
{#variable {a} {line that triggered #action}}[/u]
Back to top
View user's profile Send private message
balthus



Joined: 07 Jul 2009
Posts: 39

PostPosted: Wed Oct 09, 2013 2:38 am    Post subject: Reply with quote

If you have a look at:

Code:
#help action


You'll see that the sections of text that trigger the action are passed into variables %1 to %99 (and %0 contains the entire string). This will specifically return back what you are looking for within your action, so to retrieve back an entire line you would have to match the entire line within your action.

So your example would be:

Code:
#ACTION {^%*some text%*$}
{
    #VAR {a} {%0};
}
Back to top
View user's profile Send private message
techman246



Joined: 27 May 2013
Posts: 46

PostPosted: Thu Oct 10, 2013 12:46 am    Post subject: a little off topic Reply with quote

How would I make a variable to say pick a random number between say 1 and 4 or 5?
Back to top
View user's profile Send private message
balthus



Joined: 07 Jul 2009
Posts: 39

PostPosted: Fri Oct 11, 2013 8:09 am    Post subject: Reply with quote

Code:
#MATH {varname} {1d5}


Is one 5 sided dice roll.
Back to top
View user's profile Send private message
techman246



Joined: 27 May 2013
Posts: 46

PostPosted: Mon Oct 14, 2013 6:45 pm    Post subject: random files? Reply with quote

I am attempting to choose a random file. I have the randomness setup already and the number is stored in $rnum . So if I had file1 file2 file3 and file4 and I wanted to make tintin read one of those at random how would I go about it?
Back to top
View user's profile Send private message
balthus



Joined: 07 Jul 2009
Posts: 39

PostPosted: Fri Oct 18, 2013 3:39 am    Post subject: Reply with quote

What have you tried so far?
Back to top
View user's profile Send private message
techman246



Joined: 27 May 2013
Posts: 46

PostPosted: Sun Oct 27, 2013 9:08 pm    Post subject: solved Reply with quote

Okay I had to do file$rnum.wav
Back to top
View user's profile Send private message
techman246



Joined: 27 May 2013
Posts: 46

PostPosted: Sun Oct 27, 2013 9:11 pm    Post subject: another issue. Reply with quote

How can I take the absolute value of the a number?
Back to top
View user's profile Send private message
mrbigtaco



Joined: 26 Jun 2011
Posts: 54

PostPosted: Tue Oct 29, 2013 8:25 pm    Post subject: Reply with quote

probably something simple like:

#if {$val < 0} {
#math {val} {$val*-1}
}
Back to top
View user's profile Send private message
techman246



Joined: 27 May 2013
Posts: 46

PostPosted: Tue Nov 05, 2013 4:44 pm    Post subject: unread? Reply with quote

I know #read can be used to load all the code in a file. now is their a way to #unread or disable all the code in a specific file?
Back to top
View user's profile Send private message
techman246



Joined: 27 May 2013
Posts: 46

PostPosted: Wed Nov 06, 2013 8:35 pm    Post subject: confused me... Reply with quote

Also how would I go about taking a variable echoing its contents into another variable and overwriting the first variable with new input while having the old one in a different var
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Thu Nov 07, 2013 1:25 pm    Post subject: Reply with quote

Look at #help class which can be used to unread a file.

As for your other question:

Code:

#var a 1;#var b $a;#var a 2
Back to top
View user's profile Send private message Send e-mail
techman246



Joined: 27 May 2013
Posts: 46

PostPosted: Fri Nov 15, 2013 9:59 pm    Post subject: seems not to work Reply with quote

i attempted to use your code but i get the same issue i was running into. the second variable does not want to set itself to whatever the first variable was
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Sat Nov 16, 2013 12:50 am    Post subject: Reply with quote

Work for me.

Code:

#var a 1;#var b $a;#var a 2
#OK. VARIABLE {a} HAS BEEN SET TO {1}.
#OK. VARIABLE {b} HAS BEEN SET TO {1}.
#OK. VARIABLE {a} HAS BEEN SET TO {2}.
Back to top
View user's profile Send private message Send e-mail
techman246



Joined: 27 May 2013
Posts: 46

PostPosted: Sat Nov 16, 2013 5:37 pm    Post subject: explaination Reply with quote

when i use your code it works fine however i am trying to make it way more complex and it refuses here is the example

Code:

#var {message1} {%0}
#var {message2} {$message1}

#action {[Chatter] %*}
{#system mplayer $DIR/sounds/communication/chatter.wav $os;#variable {message1} {%0}}

#action {[TFC] %*}
{#system mplayer $DIR/sounds/communication/org.wav $os;#variable {message1} {%0}}


when a message comes in on either of these two networks i want that message to be written to
Code:
message1
and then if another one comes in whether it be on the same network or the other network it should take
Code:
message1
write it to
Code:
message2
and put the new message in
Code:
message1
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Sat Nov 16, 2013 11:25 pm    Post subject: Reply with quote

Code:

#action {[Chatter] %*}
{#system mplayer $DIR/sounds/communication/chatter.wav $os;#variable {message2} {$message1};#variable {message1} {%0}}

That ought to work.
Back to top
View user's profile Send private message Send e-mail
techman246



Joined: 27 May 2013
Posts: 46

PostPosted: Sun Nov 17, 2013 12:36 am    Post subject: okay Reply with quote

that worked perfectly now could i take that out of the action and put it on it's own in a different file and set up 9 of those instead of 2? and how would i go about it?
Back to top
View user's profile Send private message
techman246



Joined: 27 May 2013
Posts: 46

PostPosted: Sun Nov 17, 2013 10:12 am    Post subject: still a n issue Reply with quote

It does not work for multiple networks[/u]
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Sun Nov 17, 2013 12:51 pm    Post subject: Reply with quote

You'd have to create 9 actions as everything in TinTin++ is trigger based.

Maybe try:

Code:

#action {[Chatter] %*}
{#system mplayer $DIR/sounds/communication/chatter.wav $os;#variable {message[chatter]} {%0}}

#action {[TFC] %*}
{#system mplayer $DIR/sounds/communication/org.wav $os;#variable {message[org]} {%0}}


Then you could use:
Code:

#showme $message[chatter]
#showme $message[org]

If you want a history of messages you can use #list.

Code:

#list {message[chatter]} insert -1 {hello}
#list {message[chatter]} insert -1 {world}


Then:
Code:

#foreach {$message[chatter][%*]} {tmp} {#showme $tmp}
Back to top
View user's profile Send private message Send e-mail
techman246



Joined: 27 May 2013
Posts: 46

PostPosted: Mon Nov 25, 2013 7:50 pm    Post subject: lag calculator? Reply with quote

How could I make a calculator to test how long a command takes to get to the server and the responce to come back?
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Tue Nov 26, 2013 8:12 am    Post subject: Reply with quote

Code:

#format starttime %U;
#send <command>


Code:

#act {response}
{
    #format endtime %U;
    #math result $endtime - $startime / 1000000.00;
    #showme $result seconds to complete
}
Back to top
View user's profile Send private message Send e-mail
techman246



Joined: 27 May 2013
Posts: 46

PostPosted: Tue Nov 26, 2013 5:15 pm    Post subject: Reply with quote

that gave me some horrible 10 digit number
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Tue Nov 26, 2013 7:58 pm    Post subject: Reply with quote

Maybe try:

#math result ($endtime - $startime) / 1000000.00;
Back to top
View user's profile Send private message Send e-mail
techman246



Joined: 27 May 2013
Posts: 46

PostPosted: Tue Nov 26, 2013 11:03 pm    Post subject: Reply with quote

That worked perfect
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> General Discussion All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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
Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads
TinTin++ Homepage

Powered by phpBB © 2001, 2002 phpBB Group