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

Dynamic creation of #MACRO

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Script Help
View previous topic :: View next topic  
Author Message
PowerGod



Joined: 04 Aug 2014
Posts: 339

PostPosted: Tue Dec 20, 2016 4:03 pm    Post subject: Dynamic creation of #MACRO Reply with quote

Is there a trick to assign the content of a variable as an action of a #MACRO ??

Seems like them are not parsed at all, but I wonder if something like this could be possible to obtain:
Code:

#LIST keydirC CREATE {n;s;w;e;u;d}
#LIST keydirK CREATE {\e\e[A;\e\e[B;\e\e[D;\e\e[C;\e\e[6~i;\e\e[5~}

#FOREACH $keydirC count
{
#MACRO {$keydirK[$count]} {#SEND {$keydirC[$count]}}
}


The result is:
Code:

#MACRO {\e\e[5~}={#send {$keydirC[$count]}}
#MACRO {\e\e[6~i}={#send {$keydirC[$count]}}
#MACRO {\e\e[A}={#send {$keydirC[$count]}}
#MACRO {\e\e[B}={#send {$keydirC[$count]}}
#MACRO {\e\e[C}={#send {$keydirC[$count]}}
#MACRO {\e\e[D}={#send {$keydirC[$count]}}


But I want to obtain this:
Code:

#MACRO {\e\e[5~}={#send {d}}
#MACRO {\e\e[6~i}={#send {u}}
#MACRO {\e\e[A}={#send {n}}
#MACRO {\e\e[B}={#send {s}}
#MACRO {\e\e[C}={#send {e}}
#MACRO {\e\e[D}={#send {w}}



EDIT:
Found a solution... I love this program !! Ecstatic

Code:

#LIST keydirC CREATE {n;s;w;e;u;d}
#LIST keydirK CREATE {\e\e[A;\e\e[B;\e\e[D;\e\e[C;\e\e[6~i;\e\e[5~}

#FOREACH $keydirC[] count
{
  #LINE substitute variable
  {
    #MACRO {$keydirK[$count]} {#SEND {$keydirC[$count]}}
  }
}
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 -> Script Help 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