String Variable

Moderators: Voyager, BertB, grovkillen, Stuntteam, LisaM

Post Reply
Message
Author
wiredcharlie
Normal user
Posts: 57
Joined: 28 Sep 2020, 13:58

String Variable

#1 Post by wiredcharlie » 28 Oct 2020, 09:40

Please forgive me if this is covered in the docs, but if it is, there is not an example I can understand.

I want to use a string variable:

Let,4,"Bedroom" // Room

Then later:

sendtoHTTP,192.168.1.100,9000,/?player=[Var#4]&p0=mixer&p1=volume&p2=%2b[Var#3]

Please help!

Tony

TD-er
Core team member
Posts: 9256
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: String Variable

#2 Post by TD-er » 28 Oct 2020, 11:01

The variables cannot store strings. (as of now, is planned for future features)
However, you can use them as parameters in an event (perhaps not using a comma or space)

Just as a test to show you how to use it.

Sending an event via the Tools page (command input line)

Code: Select all

event,"eventname=bla,2,3,4"
And the rules to use them to create a log entry:

Code: Select all

on eventname do
  LogEntry,'Values %eventvalue1% %eventvalue2% %eventvalue3% %eventvalue4%'
endon
The entry in the log:

Code: Select all

65248 : Info   :  Webserver args: 0: 'cmd' length: 27
65260 : Info   : EVENT: eventname=bla,2,3,4
So I guess you could place this sendToHttp all inside your own event wrapper and simply use it as if it is a function call.

Code: Select all

on mysendevent do
sendtoHTTP,192.168.1.100,9000,/?player=%eventvalue1%&p0=mixer&p1=volume&p2=%2b%eventvalue2%
endon
And call it using something like this:

Code: Select all

event,"mysendevent=bedroom,123"
Only thing I'm not entirely sure of is whether "%2b%eventvalue2%" will still work.
I guess it should work as the matching strings will be replaced and %2b% is not likely to match anything.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests