Author Topic: Is it possible to print variable value as HEX not decimal?  (Read 1491 times)

Offline K4thos

  • Planewalker
  • *****
  • Posts: 110
As title suggest for debug purposes I'd like to print some values in HEX format and not decimal. Is it possible in current weidu? If not than I'd like to request this feature.

Offline Wisp

  • Moderator
  • Planewalker
  • *****
  • Posts: 1176
Re: Is it possible to print variable value as HEX not decimal?
« Reply #1 on: April 18, 2015, 06:41:44 AM »
It's undocumented, but there is SPRINTF. I suppose it is not ridiculous enough to warrant being cut, which means I'll have to document it.

Code: [Select]
OUTER_PATCH 1 BEGIN
  SPRINT str "This is a string"
  SET n = 16
  SPRINTF var "%s %x %d" ("%str%" n n)
  PATCH_PRINT "%var%"
END

Offline K4thos

  • Planewalker
  • *****
  • Posts: 110
Re: Is it possible to print variable value as HEX not decimal?
« Reply #2 on: April 18, 2015, 07:57:31 AM »
thanks, it does work. Worth documenting in readme, imo. Maybe even adding binary support ;D
« Last Edit: April 18, 2015, 07:58:54 AM by K4thos »

 

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)?: