dMZX Forums: Complex IF evaluations - dMZX Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Complex IF evaluations

#1 User is offline   darkhog 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 40
  • Joined: 20-November 12
  • Gender:Male

Posted 20 November 2012 - 06:29 PM

I am trying to do thing for which two separate variables (counter and string) have to have specific value. In another language I'd use IF variable==123 && string="abcd", but in robotic I cannot find a way to do such complex evaluations. Can you help me?
There are no impossible things, there is only lack of skills.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
~-+=SMZXDraw! The ultimate tool for editing charsets and palettes for SMZX games - FEEDBACK NEEDED!!!=+-~
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Society consists mostly of jerks. We cannot neglect their involvement into building our civilization - without them we
wouldn't have such wonderful inventions like war, money, drugs... or Microsoft Windows.
0

#2 User is offline   ThDPro 

  • Brontosaurus-Sea-slug; Gooey and phallic
  • PipPipPipPip
  • Group: Members
  • Posts: 718
  • Joined: 03-December 06
  • Gender:Male
  • Location:Portland, OR

Posted 20 November 2012 - 06:32 PM

View Postdarkhog, on 20 November 2012 - 10:29 AM, said:

I am trying to do thing for which two separate variables (counter and string) have to have specific value. In another language I'd use IF variable==123 && string="abcd", but in robotic I cannot find a way to do such complex evaluations. Can you help me?

You're not going to be able to compare strings like that in one command unfortunately, they don't quite work like that. Could you post the actual code you're trying to get to work? It's pretty hard to tell the goal currently.

Here's a, allbiet, kinda clunky, sort of complex if statement if you're interested:
if "(('playerx'!=('local1'+4))o('playery'!=('local2'+1)))" = 1 "ERG"

(the sign for logical binary 'and' (since ampersand is taken) is just 'a' for the record)

This post has been edited by ThDPro: 20 November 2012 - 06:45 PM

original soundtracks
Better Than Nothing - DOMINATION - Commander Keen: Heroes Lost - Welkin - A Confectioner's Recipe - random ThDPro music stuff
<Risu21121> if you're not going to make a good game, you might as well make a blatantly racist one.
<Kuddy> Testicles.
"Where are my folder?" - KKairos
0

#3 User is offline   Dr Lancer-X 

  • 電波、届いた?
  • Group: DigiStaff
  • Posts: 8,936
  • Joined: 20-March 02
  • Location:ur mom nmiaow

Posted 20 November 2012 - 09:53 PM

Yeah, comparing strings inside expressions is not something doable generally, you have to use messy constructs like this (which doesn't work for comparing long strings):
if "(('variable'=123)a('$string.0'=97)a('$string.1'=98)a('$string.2'=99)a('$string.3'=100)a('$string.length'=4))" = 1 then "true"


Without doing that, the example you gave cannot be expressed in one line and you have to do something like this instead:
if "variable" != 123 "false"
if "$string" != "abcd" "false"
: "true"

Posted Image
<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users