Author Topic: Traify not coping with crossplatform OUTER_SPRINTs  (Read 1653 times)

Offline jastey

  • Global Moderator
  • Planewalker
  • *****
  • Posts: 1524
  • Gender: Female
Traify not coping with crossplatform OUTER_SPRINTs
« on: June 15, 2019, 12:06:54 PM »
Hello! I want to report some findings how traify copes with the OUTER_SPRINT variables for crossplatform coding.

This gives a parse warning for the "%tutu_var%SHOPKN" after the EXTERN:

Code: [Select]
/* Nashkel shop */
CHAIN
IF WEIGHT #-1
~Global("C#BE_SHOPKN","LOCALS",0)
InParty("C#Brage") See("C#Brage") !StateCheck("C#Brage",CD_STATE_NOTVALID)~ THEN %tutu_var%SHOPKN shop_brage
~blabla~
END
IF ~~ THEN DO ~SetGlobal("C#BE_SHOPKN","LOCALS",1)~ EXTERN %tutu_var%SHOPKN 0


This gives a parse warning for the "%tutu_scriptbg%FTOWN2%eet_var%":

Code: [Select]
I_C_T %tutu_scriptbg%FTOWN2%eet_var% 1 C#BE_BGFTOWN2_1
== C#BrageJ IF ~InParty("C#Brage") See("C#Brage") !StateCheck("C#Brage",CD_STATE_NOTVALID)~ THEN ~blabla~
END

This gives parse warnings for all instances of %tutu_var%:

Code: [Select]
I_C_T %tutu_var%NOBW2 0 C#BE_NOBW2_0
== %tutu_var%NOBW2 IF ~InParty("C#Brage") See("C#Brage") !StateCheck("C#Brage",CD_STATE_NOTVALID)~ THEN ~blabla~
END




after traify-ing, this:

Code: [Select]
CHAIN
IF WEIGHT #-1
~NumTimesTalkedToGT(0)
InParty("C#Brage") InMyArea("C#Brage") !StateCheck("C#Brage",CD_STATE_NOTVALID)
Global("C#BE_GreetBardolan","LOCALS",0)~ THEN %tutu_var%BARDOL bardolan
~Blabla1~
== C#BrageJ ~I thank you, Bardolan. You did good.~
== %tutu_var%BARDOL ~Thank you, captain...~
END
IF ~~ THEN DO ~SetGlobal("C#BE_GreetBardolan","LOCALS",1)~ EXIT


becomes this pair (note that the @0 and @3 are not inside the .d-file):

Code: [Select]
CHAIN
IF WEIGHT #-1
~NumTimesTalkedToGT(0)
InParty("C#Brage") InMyArea("C#Brage") !StateCheck("C#Brage",CD_STATE_NOTVALID)
Global("C#BE_GreetBardolan","LOCALS",0)~ THEN %tutu_var%BARDOL bardolan
~Blabla1~
== C#BrageJ @1
== %tutu_var%BARDOL ~Thank you, captain...~
END
IF ~~ THEN DO ~SetGlobal("C#BE_GreetBardolan","LOCALS",1)~ EXIT

Code: [Select]
@0    = ~bardolan~ ~Blabla1~
@1    = ~I thank you, Bardolan. You did good.~
@2    = ~BARDOL~ ~Thank you, captain...~


If there is anything you could do to help weidu understand what the actual text for traify-ing is in these cases, that would be cool!

Offline Wisp

  • Moderator
  • Planewalker
  • *****
  • Posts: 1176
Re: Traify not coping with crossplatform OUTER_SPRINTs
« Reply #1 on: June 15, 2019, 06:24:26 PM »
You need to use string delimiters around the variable and appendix, for instance: ~%tutu_var%foo~. Because % is also a string delimiter, the lexer produces funny results if you use it bare like that. The parser errors in your first few examples are because having two strings in those places is not valid syntax and in the your last example, tutu_var is parsed as the name of the file, BARDOL as the state symbol and the remaining two strings as male and female.

Offline jastey

  • Global Moderator
  • Planewalker
  • *****
  • Posts: 1524
  • Gender: Female
Re: Traify not coping with crossplatform OUTER_SPRINTs
« Reply #2 on: June 16, 2019, 02:43:48 PM »
Cool. Thanks, I'll try that next time. (I do have the feeling I am posting something like this every two years or so. Sorry if this is the case.)

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: