Signup Now
Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Free User Tobbysch's Avatar
    Join Date
    May 2014
    Location
    Sweden
    Posts
    71
    Reputation
    10
    Rep Power
    21

    Working With $lastmsg

    Code:
    if $lastmsg.content ~= 'Twist of Fate' then
    gotolabel('twist')
    end

    Doesn't seem to work, why doesnt it work?



    13:46 Received blessings:
    No blessings received

  2. #2
    Free User Borges's Avatar
    Join Date
    Feb 2014
    Location
    Brazil
    Posts
    1,469
    Reputation
    205
    Rep Power
    25
    Quote Originally Posted by Tobbysch View Post
    Code:
    if $lastmsg.content ~= 'Twist of Fate' then
    gotolabel('twist')
    end

    Doesn't seem to work, why doesnt it work?



    13:46 Received blessings:
    No blessings received
    Change NpcName, BlessName and NpcMsgs

    local npcname = 'Eremo'
    local blessname = 'solitude'
    local npcmsg = 'So receive the wisdom of solitude, pilgrim.'
    local npcmsg2 = 'You already possess this blessing.'
    local npc = getcreaturebyname(npcname)

    --dont change from here
    local blessed = false
    if npc.onscreen then
    while not blessed and npc.onscreen do
    reachcreature(npc)
    if npc.dist <= 1 then
    if ischannel('NPCs') then
    npcsay('hi') waitping()
    else
    say('hi') wait(2000, 2500)
    end
    npcsay(blessname) waitping()
    npcsay('yes')

    -- wait for NPC msg
    local t = $timems + 2500
    while $timems < t and not blessed do
    wait(100)
    if ($lastnpcmsg.sender == npcname and ($lastnpcmsg.content == npcmsg or $lastnpcmsg.content == npcmsg2)) then
    blessed = true
    end
    end
    else
    playsound('monster.wav')
    wait(1000)
    end
    end
    else
    gotolabel($wptid-1)
    playsound('monster.wav')
    end
    Helped you? REP+

  3. #3
    Free User Garkstal's Avatar
    Join Date
    Dec 2013
    Location
    www.garkstalscripts.com
    Posts
    795
    Reputation
    124
    Rep Power
    23
    Quote Originally Posted by Tobbysch View Post
    Code:
    if $lastmsg.content ~= 'Twist of Fate' then
    gotolabel('twist')
    end

    Doesn't seem to work, why doesnt it work?



    13:46 Received blessings:
    No blessings received
    Its returning last msg from all channels: server log, npcs, local chat, etc.., so in your case last msg probably will be msg from npc that you bought bless or not.
    Last edited by Garkstal; 12-19-2014 at 01:25 PM.
    http://i.imgur.com/lkWkIMg.png
    ........................Script Name......................
    Profession
    Asura Palace ED + EK
    Characters for sale! | Like Our Facebook! | Sell Tibia Gold

  4. #4
    Free User Tobbysch's Avatar
    Join Date
    May 2014
    Location
    Sweden
    Posts
    71
    Reputation
    10
    Rep Power
    21
    I am using this action in my house to see if it got twist, not after it died so thanks @borges but that action is not what I need.

    And @Garkstal, it only get messages in server log, I thought of writing like:

    if $lastmsg.content ~= .. 'Twist of Fate' then
    gotolabel('twist')
    end

    But it gives me an error.

  5. #5
    Free User Sajean's Avatar
    Join Date
    Feb 2014
    Posts
    386
    Reputation
    26
    Rep Power
    21
    Quote Originally Posted by Tobbysch View Post
    I am using this action in my house to see if it got twist, not after it died so thanks @borges but that action is not what I need.

    And @Garkstal, it only get messages in server log, I thought of writing like:

    if $lastmsg.content ~= .. 'Twist of Fate' then
    gotolabel('twist')
    end

    But it gives me an error.
    Type of messages.


    -- Credits to Anonymickey, for testing the msg types
    MSG_STATUS = 0 -- Status messages (In the screen).
    MSG_DEFAULT = 1 -- Any player/npc message in Default channel.
    MSG_WHISPER = 2 -- Any player whispering.
    MSG_YELL = 3 -- Any player yelling.
    MSG_NPC = 6 -- Any NPC answers in NPC channel.
    MSG_PVT = 7 -- Private messages from other players.
    MSG_CHANNEL = 8 -- Any player message in Game/Help/Real/Tutor/Trade channel.
    MSG_RED = 16 -- Red alert messages.
    MSG_RAID,MSG_ADVANCE = 17,17 -- Any white alert message.
    MSG_WELCOME = 18 -- Game/Channel welcome messages.
    MSG_STATUSLOG = 19 -- Status messages in Server Log.
    MSG_INFO = 20 -- Green messages (like loot message) in Server Log.
    MSG_SENT = 22 -- Private messages sent by you.

    Will check all last 2000 messages.

    foreach  message  m  do
    print(m) -- You can check the type, m.type,m.content.
    end


    New messages

    foreach  newmessage  m  do
    print(m) -- You can check the type, m.type,m.content.
    end
    Last edited by Sajean; 12-19-2014 at 02:15 PM.

  6. #6
    Free User Borges's Avatar
    Join Date
    Feb 2014
    Location
    Brazil
    Posts
    1,469
    Reputation
    205
    Rep Power
    25
    Quote Originally Posted by Tobbysch View Post
    I am using this action in my house to see if it got twist, not after it died so thanks @borges but that action is not what I need.

    And @Garkstal, it only get messages in server log, I thought of writing like:

    if $lastmsg.content ~= .. 'Twist of Fate' then
    gotolabel('twist')
    end

    But it gives me an error.
    all msg is ~= 'Twist of Fate'... try
    if $lastmsg.content == 'No blessings received.' then
    --Do something
    Last edited by Borges; 12-19-2014 at 02:54 PM.
    Helped you? REP+

  7. #7
    Free User ash katchup's Avatar
    Join Date
    Dec 2013
    Location
    Brazil
    Posts
    144
    Reputation
    15
    Rep Power
    21
    Quote Originally Posted by Tobbysch View Post
    I am using this action in my house to see if it got twist, not after it died so thanks @borges but that action is not what I need.

    And @Garkstal, it only get messages in server log, I thought of writing like:

    if $lastmsg.content ~= .. 'Twist of Fate' then
    gotolabel('twist')
    end

    But it gives me an error.
    I don't own an Ornamented Ankh to test it. So, please post here what exactly appears on your server log after you use it. The WHOLE text.

  8. #8
    Moderator RoxZin xD's Avatar
    Join Date
    Dec 2013
    Location
    Rio de Janeiro
    Posts
    4,914
    Reputation
    109
    Rep Power
    31
    @Tobbysch you're looking for $lastmsg.content:match('Twist of Fate'), but this returns true, what you want returns false, so you'll have to change the way you're doing to make it work.

    When you use the ankh it returns all blessings' names and some other stuff, not only the last blessing name.



    Troubled Animals Quest [100+]
    ALL
    Feyrist Animals Surface [160+]
    RP
    Feyrist Silencers Underground X1 [180+]
    RP | EK
    Feyrist Silencers Underground X2 [200+]
    RP | EK
    Feyrist Silencers Surface [210+]
    RP | EK
    Rathleton Sewers [240+]
    RP
    Glooth Fairy [350+]
    ED/MS
    Hardcore Draken Walls [400+]
    EK

  9. #9
    Free User Tobbysch's Avatar
    Join Date
    May 2014
    Location
    Sweden
    Posts
    71
    Reputation
    10
    Rep Power
    21
    Quote Originally Posted by borges View Post
    all msg is ~= 'Twist of Fate'... try
    if $lastmsg.content == 'No blessings received'. then
    --Do something
    error in Action script wptid:93:
    ["if $lastmsg.content == 'No blessings rec..."]:Action: 93:3: 'then' expected near '.'

  10. #10
    Free User Tobbysch's Avatar
    Join Date
    May 2014
    Location
    Sweden
    Posts
    71
    Reputation
    10
    Rep Power
    21
    Quote Originally Posted by RoxZin xD View Post
    @Tobbysch you're looking for $lastmsg.content:match('Twist of Fate'), but this returns true, what you want returns false, so you'll have to change the way you're doing to make it work.

    When you use the ankh it returns all blessings' names and some other stuff, not only the last blessing name.

    This one seems to work, but if char has full bless but not twist of fate it would not work, but I guess this works for me, barely bot with full bless anyways.


    Thanks a lot @RoxZin xD !

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •