Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oneliners.bas not saving one liners on linux #1621

Closed
the-godfather-007 opened this issue Feb 5, 2024 · 16 comments
Closed

oneliners.bas not saving one liners on linux #1621

the-godfather-007 opened this issue Feb 5, 2024 · 16 comments

Comments

@the-godfather-007
Copy link

the-godfather-007 commented Feb 5, 2024

Using Linux Mint / Ubuntu. The provided oneliners.bas does not save one liners when added to the logon event within WWIV.INI. It is set up as @oneliners.bas within WWIV.ini and have scripts turned on in wwivconfig, while also have tried package file on, and package OS on (or set to YES). **Update also tested on Raspberry Pi Bookshelf / Buster / Debian and does not work their either. Could be outdated .bas, however I see it working on other 5.9 windows versions so thought I'd put it here.

Would like the ability to use basic text files for read/write using basic scripting if not already available for things such as creating one liner mods with obvious restrictions from displaying real name and passwords. If this exists, it would be helpful to see an example of a how to read/write to a text or even data file within Linux using WWIV basic scripting for reference and for other mod ideas.

Tied to this, someone requested the ability to save to a text file for purpose of having the script post to an FTN sub such as FSX_BOT or FSX_DAT, and I'd like to add the ability to post to a WWIVnet native base also, such as an experimental sub one can subscribe to. This would allow for interBBS one liners and or last callers for those of us whom may or may not have FTN's on our WWIV BBSes. Being able to code write lines to a text file, with user data such as alias, last call, gold earned, etc. can then be pushed to another BBS or used with a webhook to discord.

Being "new again" to WWIV, I'd like to see an example as to how one can create logon/logoff events to include multiple scripts, command line instructions for .sh or .bat files, multiple .bas scripts, extra ansi files being displayed, extra text written (clear screens and pauses,) all occurring within one logon process file. I would assume it's a .bas file however new to them.

@wwiv
Copy link
Contributor

wwiv commented May 17, 2024

Thanks for the report - The oneliners.bas script uses "wwiv.data.save" to save the data, it'll be in a JSON file under the data/ directory. Allowing the script to write and then push to a message base is an intersting idea, I think there's an issue here already for the message api to be opened up (I started on it once, but kept hitting some issues making it harder than I expected).

As for why oneliners isn't saving, I'll have to check it out could be a permissions issue, look in data/ and subdirs for for new JSON files. Mine is a file called this:
ONELINERS.script.json

With the following content:

{
    "data": [
        {
            "type": 0,
            "s": "|15Liner? Innat what you put on your cupboard shelves?"
        },
        {
            "type": 0,
            "s": "|11Hey your one liner is working?!  Mine on linux won't save :("
        }
    ]
}

@granitepenguin
Copy link
Contributor

granitepenguin commented May 17, 2024

I see the same thing on debian running 5.9.0.3697

the file on mine is oneliners.script.json. maybe an uppercase issue has crept in when saving. It's reading it fine.

@the-godfather-007
Copy link
Author

These are the only .json files within my /wwiv/data directory

-rwxrwxrwx 1 ghost ghost 2605 Jun 1 21:01 autoval.json
-rwxrwxrwx 1 ghost ghost 709 Jan 6 10:51 bbslist.json
-rwxrwxrwx 1 ghost ghost 1290 Jun 2 17:11 chains.json
-rwxrwxrwx 1 ghost ghost 631 Jan 20 05:59 conference.json
-rwxrwxrwx 1 ghost ghost 2156 Jan 20 05:57 dirs.json
-rwxrwxrwx 1 ghost ghost 613 Feb 24 08:21 gfiles.json
-rwxrwxrwx 1 ghost ghost 28613 Jul 2 2023 menu_commands.json
-rwxrwxrwx 1 ghost ghost 360 Feb 25 07:28 networks.json
-rwxrwxrwx 1 ghost ghost 72757 Jun 1 21:01 sl.json
-rwxrwxrwx 1 ghost ghost 10956 Feb 25 07:35 subs.json
-rw-r--r-- 1 ghost ghost 23 Feb 3 23:37 wwivd.autoblock.json
-rwxrwxrwx 1 ghost ghost 1582 Jun 1 21:01 wwivd.json

@the-godfather-007
Copy link
Author

Error code I can see via local only, maybe this will help?
Error:
Line 95, Col 6 Code 27, Abort Code 6 Name/Handle....... SysOp #1
Message: Incomplete structuInternet Address.. None.
Last0IP-Address...XXXX.XXX.XXX.XXX
Failure exiting script: 'oneliners' error code

      However it does this over telnet and ssh as well, I just don't see this error so maybe unrelated as this is my "test machine" i'm using at the moment.

@wwiv
Copy link
Contributor

wwiv commented Jun 20, 2024

which version of wwiv?

@wwiv
Copy link
Contributor

wwiv commented Jun 20, 2024

I wonder if you are running into paladin-t/my_basic#59

@the-godfather-007
Copy link
Author

My apologies for the delayed reply, I'm running wwiv 5.9.0 development. No .json file is saving at all using the included oneliners.bas example script.

@the-godfather-007
Copy link
Author

This is the .bas code. I don't see any reference to it saving to .json rather to a GLOBAL data file: wwiv.data.save("GLOBAL", l)

'
' Reinterpretation of the classic OneLiners originally
' written by Σ└¡ (Eli).
'
' This version is written in WWIVbasic v5.3 as a sample
' application.
'
import "@wwiv.io"

'
' Prints the list to the screen, one row at a time.
'
def PrintList(l)
i = iterator(l)
While move_next(i)
Print get(i)
Wend
enddef

' Returns the WWIV Pipe Color Code for
' the color name displayed in onliners
def PipeColor(c)
If c = 1 then
return "|15"
ElseIf c = 2 then
return "|01"
ElseIf c = 3 then
return "|10"
ElseIf c = 4 then
return "|12"
ElseIf c = 5 then
return "|13"
ElseIf c = 6 then
return "|07"
ElseIf c = 7 then
return "|11"
ElseIf c = 8 then
return "|14"
ElseIf c = 9 then
return "|09"
endif
' Default color.
return "|07"
enddef

def EnterOneLiner()
outstr("|15 1:White|01 2:DkBlue|10 3:Green|12 4:Red|13 5:Purple|07 6:Gray|11 7:Cyan|14 8:Yellow|09 9:Blue")
nl()
outstr("What Color? ")

color = getkey()
nl()
colorcode = ASC(LEFT(color, 1)) - ASC("0")
pipecode = PipeColor(colorcode)
outstr("|10Enter Your One Liner:")
nl()
outstr("|#9: ")
s = gets(72)

wwiv.io.outstr("|10Anonymous? ")
an = wwiv.io.ny()
If an Then
name = "Anonymous"
Else
namepart = wwiv.interpret("N")
number = wwiv.interpret("#")
name = namepart + " #" + number
End If
Return pipecode + name + " - " + s
Enddef

def Main()
l = list()
wwiv.data.load("GLOBAL", l)
done = False
cls()
While True
wwiv.io.printfile("oneliner");
PrintList(l)
nl()
outstr("|#9Would you like to add an oneliner? ")

If Not yn() Then
Return
EndIf
s = EnterOneLiner()
If len(l) > 10 Then
Remove(l, 0)
EndIf
Push(l, s)
wwiv.data.save("GLOBAL", l)
wend
enddef

Main()

@wwiv
Copy link
Contributor

wwiv commented Sep 29, 2024

That line to GLOBAL should be it.

Hmm, data/ONELINERS.script.json is the file and it seems to work for me.

@wwiv
Copy link
Contributor

wwiv commented Oct 9, 2024

Just double checked and it looks to work right on both linux and windows

@granitepenguin
Copy link
Contributor

here's my /bbs/wwiv/data/oneliners.script.json

wwiv@beaglebbs:~/data$ ls -l oneliners.script.json
-rw-r--r-- 1 wwiv wwiv 1271 Jan 24 2022 oneliners.script.json
oneliners.script.json

@wwiv
Copy link
Contributor

wwiv commented Oct 10, 2024

strange, I was able to copy your file over mine and it still worked. (I have your oneliners file live on my bbs right now)

@wwiv
Copy link
Contributor

wwiv commented Oct 10, 2024

I think I may have some ideas, I had an old script, it fails with that error on the new one, but he error makes no sense
trying to see if I can build it on windows and add some debugging

@granitepenguin
Copy link
Contributor

I think I may have some ideas, I had an old script, it fails with that error on the new one, but he error makes no sense trying to see if I can build it on windows and add some debugging

You think there's a difference in the .bas script and how it works (ie, an older version has something a newer one doesn't)? Have there been any changes to oneliners? I didn't think there have been any for quite a while.

@wwiv
Copy link
Contributor

wwiv commented Oct 10, 2024

Just found it. There's an "End If" vs. "EndIf" in the script that's causing this error. I'll send a fix.

In themean time replace "End If" with "EndIf" and it'll work. The error reporting from my_basic isn't great on this one, so it's showing up on the final line of the script and also doesn't go to the log file. I can't fix the first, but I can make sure it'll log to the logfile in addition to local console (which isn't super useful unfortunately)

@wwiv wwiv closed this as completed in 2ba5a93 Oct 10, 2024
@granitepenguin
Copy link
Contributor

worked for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants