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

how to call this function in tintin++?

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



Joined: 13 Apr 2010
Posts: 35

PostPosted: Fri Jul 22, 2011 11:11 pm    Post subject: how to call this function in tintin++? Reply with quote

In mushclient via using lua script, I can get var like using GetVariable().

eg:
Code:

hp=GetVariable("HP");


how to do this when I using lua script in tintin++?
Back to top
View user's profile Send private message
Rothsdad



Joined: 13 Apr 2010
Posts: 35

PostPosted: Sat Jul 23, 2011 9:09 pm    Post subject: Reply with quote

another script that I used in mushclient, I want to use it in tintin++ now,
how to change the script?
Code:

CnToNum={["ZERO"]=0,["ONE"]=1,["TWO"]=2,["THREE"]=3,["FOUR"]=4}
Result={}
function Get_Tishi(tishi_q,tishi_j)
        Tishi_Q=CnToNum[tishi_q]
        Tishi_J=CnToNum[tishi_j]
        PanDuan()
end

function BianLi()
        A,B,C,D=0,0,0,0
        I=1
        Result={}
        for A=1,8 do
                for B=1,8 do
                        for C=1,8 do
                                for D=1,8 do
                                        if not (A==B or A==C or A==D or B==C or B==D or C==D) then
                                                Result[I]=A..B..C..D
                                                I=I+1
                                        end
                                end
                        end
                end
        end
end

function PanDuan()
        Guess=GetVariable("Guess")
        Temp={} J=1
        a=string.sub(Guess,1,1)
        b=string.sub(Guess,2,2)
        c=string.sub(Guess,3,3)
        d=string.sub(Guess,4,4)
        for I=1,table.getn(Result) do
                q,j=0,0
                A=string.sub(Result[I],1,1)
                B=string.sub(Result[I],2,2)
                C=string.sub(Result[I],3,3)
                D=string.sub(Result[I],4,4)
                if a==A then q=q+1 end
                if b==B then q=q+1 end
                if c==C then q=q+1 end
                if d==D then q=q+1 end
                if a==B or a==C or a==D then j=j+1 end
                if b==A or b==C or b==D then j=j+1 end
                if c==A or c==B or c==D then j=j+1 end
                if d==A or d==B or d==C then j=j+1 end
                if q==Tishi_Q and j==Tishi_J then
                        Temp[J]=Result[I]
                        J=J+1
                end
        end
        Result={}
       for I=1,table.getn(Temp) do
                Result[I]=Temp[I]
        end
        SetVariable("Guess",Result[1])
        Send("guess "..GetVariable("Guess"))
end

function Init()
        BianLi()
        SetVariable("Guess",Result[1])
        Send("guess "..GetVariable("Guess"))
end
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Sat Jul 23, 2011 9:28 pm    Post subject: Reply with quote

Assuming you use #script you'd have to pass the data as a function argument.

Regarding converting the script, what exactly is it supposed to do?
Back to top
View user's profile Send private message Send e-mail
Rothsdad



Joined: 13 Apr 2010
Posts: 35

PostPosted: Sat Jul 23, 2011 10:42 pm    Post subject: Reply with quote

Scandum wrote:
Assuming you use #script you'd have to pass the data as a function argument.

Regarding converting the script, what exactly is it supposed to do?


Thanks, I'm converting the script.

but I have another question:

What's "#gts"? And how to use #gts?
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Sun Jul 24, 2011 12:48 am    Post subject: Reply with quote

gts is the name of the startup session.
Back to top
View user's profile Send private message Send e-mail
Rothsdad



Joined: 13 Apr 2010
Posts: 35

PostPosted: Sun Jul 24, 2011 9:01 am    Post subject: Reply with quote

Thanks!
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