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?
Page 1 of 1
Complex IF evaluations
#1
Posted 20 November 2012 - 06:29 PM
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.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
~-+=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.
#2
Posted 20 November 2012 - 06:32 PM
darkhog, 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
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
#3
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):
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)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"

<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
Share this topic:
Page 1 of 1

Help





