len(Dictionary.try_login) usage

0 favourites
  • 3 posts
From the Asset Store
You are a fisherman who is trying to catch some fish in the ocean.
  • Hello everyone,

    I'd assume this is a bug, but as I'm new around here I decided to ask whether or not it's me doing something wrong :)

    So, the case is that I'm receiving a string via AJAX and saving it to my dictionary:

    [AJAX] On "try_login" completed -> [Dictionary] Add key "try_login" with value AJAX.LastData

    Then, as a sub-event (fired after the value is stored) i want to check if the received value has more than three characters. This is where my problem starts, because selecting Dictionary->Compare value won't allow me to compare len() to a number (even though there is a "Greater than" option below). Even the below setup throws a "Type mismatch" error disallowing comparison <img src="smileys/smiley5.gif" border="0" align="middle" />

    <img src="http://img6.imagebanana.com/img/hbwxak36/len.PNG" border="0" />

    I'm not sure that is the intended way :) Please let me know if it's me missing something or is it an actual bug, thanks!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I think you're mis-using the dictionary compare value action.

    Instead, use the system Compare two values action to test the length of a value retrieved from the dictionary.

    This event sheet shows both how to find the length and a proper use of the dictionary compare value action.

    <img src="https://dl.dropbox.com/u/57899112/DictionaryCompare.PNG" border="0">

    If you want it for some reason: DictionaryCompare.capx

    (Another thing to keep in mind is that dictionary keys must be strings, so you may run into type mismatches if not careful.)

  • Sounds and works like a charm, thanks a lot!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)